Having some issues using PHPUnit to test my controllers.
Code I was working on so far was implementing $_POST or other request variables:
$_SERVER['REQUEST_METHOD'] = 'POST';
$_POST = array(
'test' => true
);
Most of tests worked perfectly this way until I run into methods that take uses of filter_input_array function:
$_SERVER['REQUEST_METHOD'] = 'POST';
$_REQUEST = $_POST = $GLOBALS['_POST'] = array(
'test' => true
);
// ....
var_dump(filter_input_array(INPUT_POST));
NULL
I'm not willing to remove filter_input functions from not mine code, but I'm unable to make them working in tests.
Versionings:
PHP 5.5.9-1ubuntu4.9 (cli) (built: Apr 17 2015 11:44:57)
Apache/2.4.7 (Ubuntu)
PHPUnit 4.6.6 by Sebastian Bergmann and contributors.
Any help will be appreciated.
Aucun commentaire:
Enregistrer un commentaire