1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[feature/request-class] Extracted type casting helpers from the request class.

These methods should be available without having to instantiate a request class
object, better separation of concerns. A set_var wrapper around this class no
longer requires a request object at all.

PHPBB3-9716
This commit is contained in:
Nils Adermann
2010-03-13 11:08:12 +01:00
parent 6beeda79eb
commit 85b6d3b9a1
3 changed files with 274 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
<?php
/**
*
* @package testing
* @version $Id$
* @copyright (c) 2009 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
require_once 'test_framework/framework.php';
require_once '../phpBB/includes/request/type_cast_helper_interface.php';
require_once '../phpBB/includes/request/type_cast_helper.php';
class phpbb_type_cast_helper_test extends phpbb_test_case
{
private $type_cast_helper;
protected function setUp()
{
$this->type_cast_helper = new phpbb_type_cast_helper();
}
public function test_addslashes_recursively()
{
$data = array('some"string' => array('that"' => 'really"', 'needs"' => '"escaping'));
$expected = array('some\\"string' => array('that\\"' => 'really\\"', 'needs\\"' => '\\"escaping'));
$this->type_cast_helper->addslashes_recursively($data);
$this->assertEquals($expected, $data);
}
}