mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Fix tests which might fail due to unexpected order on finds
This commit is contained in:
parent
8450b8bbc4
commit
025133db32
1 changed files with 13 additions and 9 deletions
|
@ -148,7 +148,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
/**
|
/**
|
||||||
* testInvalidContainments method
|
* testInvalidContainments method
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error_Warning
|
* @expectedException PHPUnit_Framework_Error
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testInvalidContainments() {
|
public function testInvalidContainments() {
|
||||||
|
@ -239,7 +239,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
/**
|
/**
|
||||||
* testBeforeFindWithNonExistingBinding method
|
* testBeforeFindWithNonExistingBinding method
|
||||||
*
|
*
|
||||||
* @expectedException PHPUnit_Framework_Error_Warning
|
* @expectedException PHPUnit_Framework_Error
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testBeforeFindWithNonExistingBinding() {
|
public function testBeforeFindWithNonExistingBinding() {
|
||||||
|
@ -2891,7 +2891,8 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
public function testEmbeddedFindFields() {
|
public function testEmbeddedFindFields() {
|
||||||
$result = $this->Article->find('all', array(
|
$result = $this->Article->find('all', array(
|
||||||
'contain' => array('User(user)'),
|
'contain' => array('User(user)'),
|
||||||
'fields' => array('title')
|
'fields' => array('title'),
|
||||||
|
'order' => array('Article.id' => 'ASC')
|
||||||
));
|
));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
array('Article' => array('title' => 'First Article'), 'User' => array('user' => 'mariano', 'id' => 1)),
|
array('Article' => array('title' => 'First Article'), 'User' => array('user' => 'mariano', 'id' => 1)),
|
||||||
|
@ -2902,7 +2903,8 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
|
|
||||||
$result = $this->Article->find('all', array(
|
$result = $this->Article->find('all', array(
|
||||||
'contain' => array('User(id, user)'),
|
'contain' => array('User(id, user)'),
|
||||||
'fields' => array('title')
|
'fields' => array('title'),
|
||||||
|
'order' => array('Article.id' => 'ASC')
|
||||||
));
|
));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
array('Article' => array('title' => 'First Article'), 'User' => array('user' => 'mariano', 'id' => 1)),
|
array('Article' => array('title' => 'First Article'), 'User' => array('user' => 'mariano', 'id' => 1)),
|
||||||
|
@ -2915,7 +2917,8 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
'contain' => array(
|
'contain' => array(
|
||||||
'Comment(comment, published)' => 'Attachment(attachment)', 'User(user)'
|
'Comment(comment, published)' => 'Attachment(attachment)', 'User(user)'
|
||||||
),
|
),
|
||||||
'fields' => array('title')
|
'fields' => array('title'),
|
||||||
|
'order' => array('Article.id' => 'ASC')
|
||||||
));
|
));
|
||||||
if (!empty($result)) {
|
if (!empty($result)) {
|
||||||
foreach($result as $i=>$article) {
|
foreach($result as $i=>$article) {
|
||||||
|
@ -2999,7 +3002,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
'conditions' => array('created >=' => '2007-03-18 12:24')
|
'conditions' => array('created >=' => '2007-03-18 12:24')
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
$result = $this->Article->find('all', array('fields' => array('title')));
|
$result = $this->Article->find('all', array('fields' => array('title'), 'order' => array('Article.id' => 'ASC')));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
array(
|
array(
|
||||||
'Article' => array('id' => 1, 'title' => 'First Article'),
|
'Article' => array('id' => 1, 'title' => 'First Article'),
|
||||||
|
@ -3020,7 +3023,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
$this->assertEqual($expected, $result);
|
$this->assertEqual($expected, $result);
|
||||||
|
|
||||||
$this->Article->contain(array('User(id,user)', 'Tag' => array('fields' => array('tag', 'created'))));
|
$this->Article->contain(array('User(id,user)', 'Tag' => array('fields' => array('tag', 'created'))));
|
||||||
$result = $this->Article->find('all', array('fields' => array('title')));
|
$result = $this->Article->find('all', array('fields' => array('title'), 'order' => array('Article.id' => 'ASC')));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
array(
|
array(
|
||||||
'Article' => array('id' => 1, 'title' => 'First Article'),
|
'Article' => array('id' => 1, 'title' => 'First Article'),
|
||||||
|
@ -3048,7 +3051,8 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
|
|
||||||
$result = $this->Article->find('all', array(
|
$result = $this->Article->find('all', array(
|
||||||
'fields' => array('title'),
|
'fields' => array('title'),
|
||||||
'contain' => array('User(id,user)', 'Tag' => array('fields' => array('tag', 'created')))
|
'contain' => array('User(id,user)', 'Tag' => array('fields' => array('tag', 'created'))),
|
||||||
|
'order' => array('Article.id' => 'ASC')
|
||||||
));
|
));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
array(
|
array(
|
||||||
|
@ -3082,7 +3086,7 @@ class ContainableBehaviorTest extends CakeTestCase {
|
||||||
'conditions' => array('created >=' => '2007-03-18 12:24')
|
'conditions' => array('created >=' => '2007-03-18 12:24')
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
$result = $this->Article->find('all', array('fields' => array('title')));
|
$result = $this->Article->find('all', array('fields' => array('title'), 'order' => array('Article.id' => 'ASC')));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
array(
|
array(
|
||||||
'Article' => array('id' => 1, 'title' => 'First Article'),
|
'Article' => array('id' => 1, 'title' => 'First Article'),
|
||||||
|
|
Loading…
Reference in a new issue