Wednesday, December 28, 2011

Re: Extend ControllerTestCase

Excuse me for bringing up this old topic, but I have one more question.

My TestController wrapper object contains a method which tests the
authentication layer (it's a custom layer, not the one shipped within cakephp);
consequently all the controllers' tests can easily issue
$this->testAuthKeys(...) and check whether the authentication layer has been
correctly implemented by tested controllers.

The problem is that if I assign to the aforementioned function the name
``testAuthLayer'' (or ``test*'' in general), the testsuite will try and test
the method itself. Is there a way to avoid this? (other than workarounds like
$this->_testAuthKeys..)


Regards,
Matteo

On Dec/11, Matteo Landi wrote:
> Thank for the fast response:
> - placed the wrapper inside app/Lib/Test
> - added App::uses('MyWrapper...', 'Test') on top of all my controllers tests
> - changed 'extends ControllerTestCase' to 'extends MyWrapper...'
> et voila!
>
>
> Regards,
> Matteo
>
> On Sun, Dec 11, 2011 at 11:54 AM, euromark <dereuromark@googlemail.com> wrote:
> > also create a package name for it (e.g. Test)
> >
> > App::uses('My...', 'Test');
> > App::uses('My...', 'PluginName.Test');
> >
> >
> > On 11 Dez., 11:52, euromark <dereurom...@googlemail.com> wrote:
> >> I place mine in the Lib folder
> >> either plugin (cross app) or app Lib folder.
> >> in 2.0 you can
> >>
> >> On 11 Dez., 11:30, Matteo Landi <mat...@matteolandi.net> wrote:
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> > Hi,
> >> > where is the right place to put a class which extends and add some
> >> > functionalities to ControllerTestCase so that I can it inside all my
> >> > controllers tests? Imagine all my controllers tests implement a
> >> > testAction wrapper: it would be handy to extend ControllerTestCase,
> >> > implement such wrapper in there, and finally make all my tests extend
> >> > MyControllerTestCase instead of the legacy one.
> >>
> >> > Regards,
> >> > Matteo
> >>
> >> > --http://www.matteolandi.net/
> >
> > --
> > Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
> > Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
> >
> >
> > 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
> >
>
>
>
> --
> http://www.matteolandi.net/

--
http://www.matteolandi.net

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


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

No comments: