problem with PHPUnit and testing a controller

2 messages Options
Embed this post
Permalink
Joe Theplumber

problem with PHPUnit and testing a controller

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
I am writing some tests for a zf app. Most of them are very simple but the first one where I am actually posting data is failing. Since my other ones are working, I think that most likely, it is set up correctly but I'm not sure what next step would be (grabbing values out of the the dispatcher? ). thanks for any help.


    public function testLogin(){
        $request=$this->getRequest();
        $request->setMethod('POST');
        $request->setPost(array('email'=>'xxx','password'=>'xxx'));
        Zend_Debug::dump($request->getParams());
        Zend_Debug::dump($request->getMethod());
        Zend_Debug::dump($request);

        $this->dispatch('/user/login');
        $this->assertRedirectTo('/user/home');
    }

-jonathan

A.J. Brown-3

Re: problem with PHPUnit and testing a controller

Reply Threaded More More options
Print post
Permalink
What exactly do you mean when you say it's failing?  Is the assertion failing?

On Mon, Nov 2, 2009 at 7:31 AM, water <[hidden email]> wrote:

> I am writing some tests for a zf app. Most of them are very simple but the
> first one where I am actually posting data is failing. Since my other ones
> are working, I think that most likely, it is set up correctly but I'm not
> sure what next step would be (grabbing values out of the the dispatcher? ).
> thanks for any help.
>
>
>     public function testLogin(){
>         $request=$this->getRequest();
>         $request->setMethod('POST');
>         $request->setPost(array('email'=>'xxx','password'=>'xxx'));
>         Zend_Debug::dump($request->getParams());
>         Zend_Debug::dump($request->getMethod());
>         Zend_Debug::dump($request);
>
>         $this->dispatch('/user/login');
>         $this->assertRedirectTo('/user/home');
>     }
>
> -jonathan
>
>



--
A.J. Brown
web | http://ajbrown.org
phone | (937) 660-3969