I've solved the problem for the moment.
With this
server.test.php
App::import('Model', 'Server');
include_once 'PocadsTestCase.php';
class ServerTestCase extends CustomTestCase {
function startTest() {
$this->Server =& ClassRegistry::init('Server');
}
function TestFindFirst(){
$this->Server->recursive = 0;
$result = $this->Server->find('first');
$this->assertNotNull($result);
$expected = array('Server' =>
array(
'id' => 1,
'name' => 'Lorem ipsum dolor
sit amet',
'is_selectable' => 1,
'soap_url' => 'Lorem ipsum
dolor sit amet'
));
$this->assertEqual($result, $expected);
}
function endTest() {
unset($this->Server);
ClassRegistry::flush();
}
}
CustomTestCase.php
-
class CustomTestCase extends CakeTestCase
{
var $fixtures = array('app.server', 'app.modem',
'app.keyword');
}
On Jul 21, 12:10 pm, "adamcl...@gmail.com"
wrote:
> I'm tired of having to include all of my fixtures when I create a new
> test case. Is there a method to generate all fixtures needed? I
> noticed that he 'cake bake test' command can generate a list of
> fixtures. Is there some way to expose that so when my DB/Model
> changes I don't have to modify every single test case.
>
> ---
> App::import('Model', 'Server');
>
> class ServerTestCase extends CakeTestCase {
>
> //This list is generated by 'cake bake test'
> var $fixtures = array('app.server', 'app.modem',
> 'app.keyword');
>
> //Id like somthing like this
> //var $fixtures = $this->generateFixtures('app.server');
>
> function startTest() {
> $this->Server =& ClassRegistry::init('Server');
> }
>
> function endTest() {
> unset($this->Server);
> ClassRegistry::flush();
> }
>
> }
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+unsubscr...@googlegroups.com For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en