Saturday, December 26, 2009

Re: testing a controller's add action

Is your add action using a redirect?
John

On Dec 26, 6:48 pm, Lorenzo Bettini <bett...@dsi.unifi.it> wrote:
> Hi
>
> I already managed to test some actions of controllers using testAction
> method; these were actions that were expected to return something.
>
> Now, I'd like to test an add action of the controller, thus, following
> the book I did:
>
> $data = array(
>         'Paper' => array(
>                 'title' => 'MyTitle',
>                 'year' => 2009
>         ));
> debug($data);
> $results = $this->testAction(
>         array(
>         'controller' => 'papers',
>         'action' => 'admin_add',
>         ),
>         array('data' => $data, 'method' => 'post')
>         );
>
> but when executing the controller's action (I tried that with the
> debug), the $this->data is always empty and uninitialized...  where am I
> going wrong?
>
> thanks in advance
>         Lorenzo
>
> --
> Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
> HOME:http://www.lorenzobettini.itMUSIC:http://www.purplesucker.com
> BLOGS:http://tronprog.blogspot.com http://longlivemusic.blogspot.com

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate