function setUp() { Piece_Right_Error::pushCallback(create_function('$error', 'var_dump($error); return ' . PEAR_ERRORSTACK_DIE . ';')); $this->_cacheDirectory = dirname(__FILE__) . '/' . basename(__FILE__, '.php'); $this->_oldFilterDirectories = $GLOBALS['PIECE_RIGHT_Filter_Directories']; Piece_Right_Filter_Factory::addFilterDirectory($this->_cacheDirectory); $this->_oldValidatorDirectories = $GLOBALS['PIECE_RIGHT_Validator_Directories']; Piece_Right_Validator_Factory::addValidatorDirectory($this->_cacheDirectory); }
/** * @since Method available since Release 1.3.0 */ function testPayload() { $oldValidatorDirectories = $GLOBALS['PIECE_RIGHT_Validator_Directories']; Piece_Right_Validator_Factory::addValidatorDirectory($this->_cacheDirectory); $config =& new Piece_Right_Config(); $config->addValidation('email', 'ScriptPayloadTest'); $container =& new stdClass(); $payload =& new stdClass(); $script =& new Piece_Right_Validation_Script($this->_cacheDirectory, $this->_cacheDirectory, null, array(&$this, 'turnOnPostRunCallbackCalled')); $script->setPayload($payload); $results = $script->run('Script', $container, $config); $this->assertEquals(0, $results->countErrors()); $this->assertTrue(array_key_exists('foo', $payload)); $this->assertEquals('bar', $payload->foo); $GLOBALS['PIECE_RIGHT_Validator_Directories'] = $oldValidatorDirectories; }
/** * Adds a validator directory. * * @param array $directory * @static * @since Method available since Release 0.8.0 */ function addValidatorDirectory($directory) { Piece_Right_Validator_Factory::addValidatorDirectory($directory); }