Adding test cases to Containable, disproves and closes #4934

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7229 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
mariano.iglesias 2008-06-21 23:41:54 +00:00
parent 605bfa5bc5
commit 64d49c8afc

View file

@ -3003,6 +3003,28 @@ class ContainableTest extends CakeTestCase {
) )
); );
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$this->assertTrue(empty($this->User->Article->hasAndBelongsToMany['Tag']['conditions']));
$result = $this->User->find('all', array('contain' => array(
'Article.Tag' => array('conditions' => array('created >=' => '2007-03-18 12:24'))
)));
$this->assertTrue(Set::matches('/User[id=1]', $result));
$this->assertFalse(Set::matches('/Article[id=1]/Tag[id=1]', $result));
$this->assertTrue(Set::matches('/Article[id=1]/Tag[id=2]', $result));
$this->assertTrue(empty($this->User->Article->hasAndBelongsToMany['Tag']['conditions']));
$this->assertTrue(empty($this->User->Article->hasAndBelongsToMany['Tag']['order']));
$result = $this->User->find('all', array('contain' => array(
'Article.Tag' => array('order' => 'created DESC')
)));
$this->assertTrue(Set::matches('/User[id=1]', $result));
$this->assertTrue(Set::matches('/Article[id=1]/Tag[id=1]', $result));
$this->assertTrue(Set::matches('/Article[id=1]/Tag[id=2]', $result));
$this->assertTrue(empty($this->User->Article->hasAndBelongsToMany['Tag']['order']));
} }
/** /**
* testOtherFinds method * testOtherFinds method