Hello Matthew,

thanks for your answer. But I don't actually try to test the hashed element.
I just wanna test a form containing it. But whenever a form contains a hash
element, I'm unable to process the form. For example the login form:

        $form = new Zend_Form(array(
            'action'   => '/login',
            'method'   => 'post',
            'name'         => 'loginForm',
            'elements' => array(
                'username' => array('text', array(
                    'validators' => array(
                        'alnum',
                        array('regex', false, array('/^[a-z]/i')),
                        array('stringLength', false, array(6, 20))
                    ),
                    'required' => true,
                    'label' => 'Username',
                    'filters'  => array('StringToLower'),
                 )),
                'password' => array('password', array(
                    'validators' => array(
                        array('stringLength', false, array(6))
                    ),
                    'required' => true,
                    'label' => 'Password',
                )),
                #'hash' => 'hash',
                'submit' => 'submit',
                )
            ));



    function testLogin()
    {
        $this->dispatch('/');
        $this->request
             ->setMethod('POST')
             ->setPost(array(
                 'username' => 'username',
                 'password' => 'password'
             ));
        $this->dispatch('/login');
        $this->assertModule('ucp');
        $this->assertController('auth');
        $this->assertAction('login');
        $this->assertRedirectTo('/');
        $this->dispatch('/');
        $this->assertTrue(Zend_Auth::getInstance()->hasIdentity());
        $this->assertEquals((int) User::get('userId'), 1);
        $this->resetResponse();
        $this->request->setPost(array());
    }

As soon as I disable the hash element it processes fine. Any ideas?

By the way: Thanks for the great work on ZF - it's really awesome!


-- 
View this message in context: 
http://www.nabble.com/Zend_Test_PHPUnit-and-hashed-form-elements-tp18796568p18813545.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to