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:
33
tests/request/type_cast_helper.php
Normal file
33
tests/request/type_cast_helper.php
Normal 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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user