mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
adding model test, closes #5819
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7917 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
3682c9c6ae
commit
24cc66b43e
1 changed files with 39 additions and 0 deletions
|
@ -3000,6 +3000,45 @@ class ModelTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertEqual($result['Monkey'], $expected);
|
||||
}
|
||||
/**
|
||||
* testHabtmDeleteLinksWhenNoPrimaryKeyInJoinTable method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testHabtmDeleteLinksWhenNoPrimaryKeyInJoinTable() {
|
||||
|
||||
$this->loadFixtures('Apple', 'Device', 'ThePaperMonkies');
|
||||
$ThePaper =& new ThePaper();
|
||||
$ThePaper->id = 1;
|
||||
$ThePaper->save(array('Monkey' => array(2, 3)));
|
||||
|
||||
$result = $ThePaper->findById(1);
|
||||
$expected = array(
|
||||
array('id' => '2', 'device_type_id' => '1', 'name' => 'Device 2', 'typ' => '1'),
|
||||
array('id' => '3', 'device_type_id' => '1', 'name' => 'Device 3', 'typ' => '2')
|
||||
);
|
||||
$this->assertEqual($result['Monkey'], $expected);
|
||||
|
||||
$ThePaper =& new ThePaper();
|
||||
$ThePaper->id = 2;
|
||||
$ThePaper->save(array('Monkey' => array(2, 3)));
|
||||
|
||||
$result = $ThePaper->findById(2);
|
||||
$expected = array(
|
||||
array('id' => '2', 'device_type_id' => '1', 'name' => 'Device 2', 'typ' => '1'),
|
||||
array('id' => '3', 'device_type_id' => '1', 'name' => 'Device 3', 'typ' => '2')
|
||||
);
|
||||
$this->assertEqual($result['Monkey'], $expected);
|
||||
|
||||
$ThePaper->delete(1);
|
||||
$result = $ThePaper->findById(2);
|
||||
$expected = array(
|
||||
array('id' => '2', 'device_type_id' => '1', 'name' => 'Device 2', 'typ' => '1'),
|
||||
array('id' => '3', 'device_type_id' => '1', 'name' => 'Device 3', 'typ' => '2')
|
||||
);
|
||||
$this->assertEqual($result['Monkey'], $expected);
|
||||
}
|
||||
/**
|
||||
* test that Caches are getting cleared on save().
|
||||
* ensure that both inflections of controller names are getting cleared
|
||||
|
|
Loading…
Add table
Reference in a new issue