I placed BaseCase in the root of app/tests/cases

<?php
/**
  * Base test case
  */
class BaseCase extends CakeTestCase {
  var $fixtures = array(
          'plugin.configuration.configuration',
          'app.category',
          'app.user',
          'app.blog',
          'app.download',
          'app.comment',
          'app.tag',
          'app.blog_tag',
          'app.upload',
          'app.work',
        );
}
?>


Then in each test case:

<?php
App::import('Model', 'Blog');
App::import('Tests', 'BaseCase', null, array(dirname(__FILE__) . DS  .
'..' . DS));
class BlogTestCase extends BaseCase {
   var $Blog = null;

// tests go here

}
?>

I don't have any $import or $records in my inherited classes.

Hope that helps,
Nick

On Sep 15, 8:02 pm, "j.blotus" <[email protected]> wrote:
> was there a specific location you dropper your BaseCase file in? or
> any imports that I am missing?
>
> On Sep 13, 11:52 pm, nurvzy <[email protected]> wrote:
>
>
>
> > If you use lazy_loading you can get past this, only unit test what
> > each model will actually use, instead of having to load all fixtures
> > for each because of the default model chaining behavior required for
> > PHP4 support.
>
> > An alternative I've found useful prior to lazy_loading was creating a
> > BaseCase that extends CakeTestCase and loads all your fixtures in
> > there.  Then simply extend your BaseCase when doing model testing,
> > easy as pie.
>
> > class BaseCase extends CakeTestCase{
> >   var $fixtures = array(
> >     //..fixtures here
> >   );
>
> > }
>
> > Then with any new test I would just make sure to require BaseCase and
> > extend it.
> > require_once(dirname(__FILE__) . 'base_case.php');
>
> > class ModelTestCase extends BaseCase {
> >   //Tests go here.
>
> > }
>
> > But this was all prior to lazy_loading.   If you use lazy_loading
> > (http://github.com/Phally/lazy_model) you can just use what table your
> > model test will actually use ignoring the rest, a much more efficient
> > approach to testing.
>
> > Hope that helps,
> > Nick
>
> > On Sep 13, 1:32 pm, "j.blotus" <[email protected]> wrote:
>
> > > When I am testing a model, every time I create a new model in my
> > > application, I have to add it in to my $fixtures array for each test
> > > case, or I get missing table errors when testing.
>
> > > Is it possible to define $fixtures in just one spot?
>
> > > maybe app_cake_test_case or something like that?
>
> > > This can become a big problem the more tests I write.
>
> > > My current array =
>
> > > var $fixtures = array(
> > >         'app.booking',
> > >         'app.listing',
> > >         'app.instant_payment_notification',
> > >         'app.transaction',
> > >         'app.package',
> > >         'app.promo_code',
> > >         'app.note',
> > >         'app.inquiry',
> > >         'app.event',
> > >         'app.event_type',
> > >         'app.publisher',
> > >         'app.report',
> > >         'app.country',
> > >         'app.state',
> > >         'app.region',
> > >         'app.city',
> > >         'app.user',
> > >         'app.review',
> > >         'app.image',
> > >         'app.deal',
> > >         'app.visit'
> > >     );

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 [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to