diff options
author | Nils Adermann <naderman@naderman.de> | 2010-03-13 11:08:12 +0100 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2010-09-17 14:00:01 +0200 |
commit | 85b6d3b9a1b346f36232d98bcf308f5635eb7f49 (patch) | |
tree | f7a17fba1790cbaa145d904ec57ddcd43938f5e1 /tests/request | |
parent | 6beeda79eb5a001b589e987d832acf4ea0ae5b4f (diff) | |
download | forums-85b6d3b9a1b346f36232d98bcf308f5635eb7f49.tar forums-85b6d3b9a1b346f36232d98bcf308f5635eb7f49.tar.gz forums-85b6d3b9a1b346f36232d98bcf308f5635eb7f49.tar.bz2 forums-85b6d3b9a1b346f36232d98bcf308f5635eb7f49.tar.xz forums-85b6d3b9a1b346f36232d98bcf308f5635eb7f49.zip |
[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
Diffstat (limited to 'tests/request')
-rw-r--r-- | tests/request/type_cast_helper.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/request/type_cast_helper.php b/tests/request/type_cast_helper.php new file mode 100644 index 0000000000..aba8523ec3 --- /dev/null +++ b/tests/request/type_cast_helper.php @@ -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); + } +} |