lithium\tests\cases\security\auth\adapter\FormTest::testGenericFilter PHP Method

testGenericFilter() public method

public testGenericFilter ( )
    public function testGenericFilter()
    {
        $subject = new Form(array('model' => __CLASS__, 'fields' => array('username', 'password', 'group', 'secret'), 'filters' => array(function ($form) {
            unset($form['secret']);
            return $form;
        }), 'validators' => array('password' => false)));
        $request = (object) array('data' => array('username' => 'bob', 'group' => 'editors', 'secret' => 'value', 'password' => 'foo!'));
        $result = $subject->check($request);
        $expected = array('username' => 'bob', 'group' => 'editors', 'password' => 'foo!');
        $this->assertEqual($expected, $result);
        $subject = new Form(array('model' => __CLASS__, 'fields' => array('username', 'password', 'group', 'secret'), 'validators' => array('password' => false)));
        $request = (object) array('data' => array('username' => 'bob', 'group' => 'editors', 'secret' => 'value', 'password' => 'foo!'));
        $result = $subject->check($request);
        $expected = array('username' => 'bob', 'group' => 'editors', 'password' => 'foo!', 'secret' => 'value');
        $this->assertEqual($expected, $result);
    }