I have a test case, example:
class ArticlesControllerTest extends CakeTestCase {
function testAdd() {
$data = array('Article' => array('user_id' => 1, 'published'
=> 1, 'slug'=>'new-article', 'title' => 'New Article',
'body' => 'New Body'));
$result = $this->testAction('/articles/add',
array('data' => $data, 'method' => 'post'));
$this->assertTrue($result );
}
}
Now I want add a new test in the same function to check if another
table was affected, suppose Users:
class ArticlesControllerTest extends CakeTestCase {
function testAdd() {
$data = array('Article' => array('user_id' => 1, 'published'
=> 1, 'slug'=>'new-article', 'title' => 'New Article',
'body' => 'New Body'));
$result = $this->testAction('/articles/add',
array('data' => $data, 'method' => 'post'));
$this->assertTrue($result );
//****** New Test *******
$this->User =& ClassRegistry::init('User');
$result = $this->User->field('articles_counter', array('id'=>1));
$this->assertEqual($result, 5);
}
}
The example works but the new test check the live table not the one
created with the prefix "test_suite_". How do I get the records in the
fixture table?
Marco
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---