mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Updating tests to use new find notation.
This commit is contained in:
parent
7efe15393d
commit
4828e16762
3 changed files with 56 additions and 56 deletions
|
@ -288,7 +288,7 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->Tree->initialize(2, 2);
|
||||
|
||||
$this->Tree->save(array($modelClass => array('name' => 'testAddOrphan', $parentField => null)));
|
||||
$result = $this->Tree->find(null, array('name', $parentField), $modelClass . '.' . $leftField . ' desc');
|
||||
$result = $this->Tree->find('first', array('fields' => array('name', $parentField), 'order' => $modelClass . '.' . $leftField . ' desc'));
|
||||
$expected = array($modelClass => array('name' => 'testAddOrphan', $parentField => null));
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
|
@ -307,7 +307,7 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->Tree = new $modelClass();
|
||||
$this->Tree->initialize(2, 2);
|
||||
|
||||
$data= $this->Tree->find(array($modelClass . '.name' => '1.1'), array('id'));
|
||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1')));
|
||||
$initialCount = $this->Tree->find('count');
|
||||
|
||||
$this->Tree->create();
|
||||
|
@ -367,7 +367,7 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->Tree->initialize(2, 2);
|
||||
|
||||
$this->Tree->save(array('name' => 'testAddNotIndexed', $parentField => null));
|
||||
$result = $this->Tree->find(null, array('name', $parentField), $modelClass . '.' . $leftField . ' desc');
|
||||
$result = $this->Tree->find('first', array('fields' => array('name', $parentField), 'order' => $modelClass . '.' . $leftField . ' desc'));
|
||||
$expected = array($modelClass => array('name' => 'testAddNotIndexed', $parentField => null));
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
|
@ -387,10 +387,10 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->Tree->initialize(2, 2);
|
||||
$this->Tree->id = null;
|
||||
|
||||
$parent = $this->Tree->find(array($modelClass . '.name' => '1. Root'));
|
||||
$parent = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
||||
$parent_id = $parent[$modelClass]['id'];
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1.1.1'), array('id'));
|
||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1.1')));
|
||||
$this->Tree->id= $data[$modelClass]['id'];
|
||||
$this->Tree->saveField($parentField, $parent_id);
|
||||
$direct = $this->Tree->children($parent_id, true, array('id', 'name', $parentField, $leftField, $rightField));
|
||||
|
@ -414,10 +414,10 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->Tree->initialize(2, 2);
|
||||
$this->Tree->id = null;
|
||||
|
||||
$parent = $this->Tree->find(array($modelClass . '.name' => '1. Root'));
|
||||
$parent = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
||||
$parent_id = $parent[$modelClass]['id'];
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1.1.1'), array('id'));
|
||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1.1')));
|
||||
$this->Tree->id = $data[$modelClass]['id'];
|
||||
$this->Tree->whitelist = array($parentField, 'name', 'description');
|
||||
$this->Tree->saveField($parentField, $parent_id);
|
||||
|
@ -461,10 +461,10 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->Tree->initialize(2, 2);
|
||||
$this->Tree->id = null;
|
||||
|
||||
$parent = $this->Tree->find(array($modelClass . '.name' => '1.1'));
|
||||
$parent = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1.1')));
|
||||
$parent_id = $parent[$modelClass]['id'];
|
||||
|
||||
$data= $this->Tree->find(array($modelClass . '.name' => '1.2'), array('id'));
|
||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.2')));
|
||||
$this->Tree->id = $data[$modelClass]['id'];
|
||||
$this->Tree->saveField($parentField, $parent_id);
|
||||
|
||||
|
@ -490,10 +490,10 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->Tree->initialize(2, 2);
|
||||
$this->Tree->id = null;
|
||||
|
||||
$parent = $this->Tree->find(array($modelClass . '.name' => '1.2'));
|
||||
$parent = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1.2')));
|
||||
$parent_id = $parent[$modelClass]['id'];
|
||||
|
||||
$data= $this->Tree->find(array($modelClass . '.name' => '1.1'), array('id'));
|
||||
$data= $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1')));
|
||||
$this->Tree->id = $data[$modelClass]['id'];
|
||||
$this->Tree->saveField($parentField, $parent_id);
|
||||
|
||||
|
@ -519,10 +519,10 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->Tree->initialize(2, 2);
|
||||
$this->Tree->id = null;
|
||||
|
||||
$parent = $this->Tree->find(array($modelClass . '.name' => '1. Root'));
|
||||
$parent = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
||||
$parent_id = $parent[$modelClass]['id'];
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1.1.1'), array('id'));
|
||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1.1')));
|
||||
|
||||
$expects = $this->Tree->find('all');
|
||||
$before = $this->Tree->read(null, $data[$modelClass]['id']);
|
||||
|
@ -606,7 +606,7 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->Tree = new $modelClass();
|
||||
$this->Tree->initialize(2, 2);
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1.2'), array('id'));
|
||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.2')));
|
||||
$this->Tree->moveUp($data[$modelClass]['id']);
|
||||
|
||||
$parent = $this->Tree->findByName('1. Root', array('id'));
|
||||
|
@ -628,7 +628,7 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->Tree = new $modelClass();
|
||||
$this->Tree->initialize(2, 2);
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1.1'));
|
||||
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1.1')));
|
||||
|
||||
$this->Tree->moveUp($data[$modelClass]['id']);
|
||||
|
||||
|
@ -651,7 +651,7 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->Tree = new $modelClass();
|
||||
$this->Tree->initialize(1, 10);
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1.5'), array('id'));
|
||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.5')));
|
||||
$this->Tree->moveUp($data[$modelClass]['id'], 2);
|
||||
|
||||
$parent = $this->Tree->findByName('1. Root', array('id'));
|
||||
|
@ -682,7 +682,7 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->Tree = new $modelClass();
|
||||
$this->Tree->initialize(1, 10);
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1.5'), array('id'));
|
||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.5')));
|
||||
$this->Tree->moveUp($data[$modelClass]['id'], true);
|
||||
|
||||
$parent = $this->Tree->findByName('1. Root', array('id'));
|
||||
|
@ -713,7 +713,7 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->Tree = new $modelClass();
|
||||
$this->Tree->initialize(2, 2);
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1.1'), array('id'));
|
||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1')));
|
||||
$this->Tree->moveDown($data[$modelClass]['id']);
|
||||
|
||||
$parent = $this->Tree->findByName('1. Root', array('id'));
|
||||
|
@ -735,7 +735,7 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->Tree = new $modelClass();
|
||||
$this->Tree->initialize(2, 2);
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1.2'));
|
||||
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1.2')));
|
||||
$this->Tree->moveDown($data[$modelClass]['id']);
|
||||
|
||||
$parent = $this->Tree->findByName('1. Root', array('id'));
|
||||
|
@ -757,7 +757,7 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->Tree = new $modelClass();
|
||||
$this->Tree->initialize(1, 10);
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1.5'), array('id'));
|
||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.5')));
|
||||
$this->Tree->moveDown($data[$modelClass]['id'], true);
|
||||
|
||||
$parent = $this->Tree->findByName('1. Root', array('id'));
|
||||
|
@ -788,7 +788,7 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->Tree = new $modelClass();
|
||||
$this->Tree->initialize(1, 10);
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1.5'), array('id'));
|
||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.5')));
|
||||
$this->Tree->moveDown($data[$modelClass]['id'], 2);
|
||||
|
||||
$parent = $this->Tree->findByName('1. Root', array('id'));
|
||||
|
@ -819,7 +819,7 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->Tree = new $modelClass();
|
||||
$this->Tree->initialize(1, 10);
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1.5'), array('id'));
|
||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.5')));
|
||||
$this->Tree->id = $data[$modelClass]['id'];
|
||||
$this->Tree->saveField('name', 'renamed');
|
||||
$parent = $this->Tree->findByName('1. Root', array('id'));
|
||||
|
@ -849,7 +849,7 @@ class NumberTreeTest extends CakeTestCase {
|
|||
extract($this->settings);
|
||||
$this->Tree = new $modelClass();
|
||||
$this->Tree->initialize(1, 1);
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1.1'), array('id'));
|
||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1')));
|
||||
$this->Tree->id = $data[$modelClass]['id'];
|
||||
$this->Tree->save(array($parentField => null));
|
||||
|
||||
|
@ -1077,7 +1077,7 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->Tree = new $modelClass();
|
||||
$this->Tree->initialize(2, 2);
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1. Root'));
|
||||
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
||||
$this->Tree->id= $data[$modelClass]['id'];
|
||||
|
||||
$direct = $this->Tree->children(null, true, array('id', 'name', $parentField, $leftField, $rightField));
|
||||
|
@ -1108,7 +1108,7 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->Tree = new $modelClass();
|
||||
$this->Tree->initialize(2, 2);
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1. Root'));
|
||||
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
||||
$this->Tree->id = $data[$modelClass]['id'];
|
||||
|
||||
$direct = $this->Tree->childCount(null, true);
|
||||
|
@ -1129,7 +1129,7 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->Tree = new $modelClass();
|
||||
$this->Tree->initialize(2, 2);
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1.2.2'));
|
||||
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1.2.2')));
|
||||
$this->Tree->id= $data[$modelClass]['id'];
|
||||
|
||||
$result = $this->Tree->getParentNode(null, array('name'));
|
||||
|
@ -1148,7 +1148,7 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->Tree = new $modelClass();
|
||||
$this->Tree->initialize(2, 2);
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1.2.2'));
|
||||
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1.2.2')));
|
||||
$this->Tree->id= $data[$modelClass]['id'];
|
||||
|
||||
$result = $this->Tree->getPath(null, array('name'));
|
||||
|
@ -1171,7 +1171,7 @@ class NumberTreeTest extends CakeTestCase {
|
|||
array('className' => $modelClass, 'foreignKey' => $parentField, 'conditions' => array('Dummy.id' => null)))), false);
|
||||
$this->Tree->initialize(2, 2);
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1. Root'));
|
||||
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
||||
$this->Tree->id= $data[$modelClass]['id'];
|
||||
|
||||
$direct = $this->Tree->children(null, true, array('id', 'name', $parentField, $leftField, $rightField));
|
||||
|
@ -1203,13 +1203,13 @@ class NumberTreeTest extends CakeTestCase {
|
|||
$this->Tree->initialize(3, 3);
|
||||
$nodes = $this->Tree->find('list', array('order' => $leftField));
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1.1'), array('id'));
|
||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1')));
|
||||
$this->Tree->moveDown($data[$modelClass]['id']);
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1.2.1'), array('id'));
|
||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.2.1')));
|
||||
$this->Tree->moveDown($data[$modelClass]['id']);
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1.3.2.2'), array('id'));
|
||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.3.2.2')));
|
||||
$this->Tree->moveDown($data[$modelClass]['id']);
|
||||
|
||||
$unsortedNodes = $this->Tree->find('list', array('order' => $leftField));
|
||||
|
@ -1676,10 +1676,10 @@ class UuidTreeTest extends CakeTestCase {
|
|||
$this->Tree->initialize(2, 2);
|
||||
$this->Tree->id = null;
|
||||
|
||||
$parent = $this->Tree->find(array($modelClass . '.name' => '1. Root'));
|
||||
$parent = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
||||
$parent_id = $parent[$modelClass]['id'];
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1.1.1'), array('id'));
|
||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1.1')));
|
||||
$this->Tree->id= $data[$modelClass]['id'];
|
||||
$this->Tree->saveField($parentField, $parent_id);
|
||||
$direct = $this->Tree->children($parent_id, true, array('name', $leftField, $rightField));
|
||||
|
@ -1702,10 +1702,10 @@ class UuidTreeTest extends CakeTestCase {
|
|||
$this->Tree->initialize(2, 2);
|
||||
$this->Tree->id = null;
|
||||
|
||||
$parent = $this->Tree->find(array($modelClass . '.name' => '1. Root'));
|
||||
$parent = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
||||
$parent_id = $parent[$modelClass]['id'];
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1.1.1'), array('id'));
|
||||
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1.1')));
|
||||
$this->Tree->id = $data[$modelClass]['id'];
|
||||
$this->Tree->whitelist = array($parentField, 'name', 'description');
|
||||
$this->Tree->saveField($parentField, $parent_id);
|
||||
|
@ -1794,7 +1794,7 @@ class UuidTreeTest extends CakeTestCase {
|
|||
$this->Tree = new $modelClass();
|
||||
$this->Tree->initialize(2, 2);
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1. Root'));
|
||||
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
||||
$this->Tree->id = $data[$modelClass]['id'];
|
||||
|
||||
$direct = $this->Tree->children(null, true, array('name', $leftField, $rightField));
|
||||
|
@ -1825,7 +1825,7 @@ class UuidTreeTest extends CakeTestCase {
|
|||
$this->Tree->bindModel(array('belongsTo' => array('Dummy' =>
|
||||
array('className' => $modelClass, 'foreignKey' => $parentField, 'conditions' => array('Dummy.id' => null)))), false);
|
||||
|
||||
$data = $this->Tree->find(array($modelClass . '.name' => '1. Root'));
|
||||
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
||||
$this->Tree->id = $data[$modelClass]['id'];
|
||||
|
||||
$direct = $this->Tree->children(null, true, array('name', $leftField, $rightField));
|
||||
|
|
|
@ -5087,7 +5087,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
$this->loadFixtures('Portfolio', 'Item', 'ItemsPortfolio', 'Syfile', 'Image');
|
||||
$Portfolio = new Portfolio();
|
||||
|
||||
$result = $Portfolio->find(array('id' => 2), null, null, 3);
|
||||
$result = $Portfolio->find('first', array('conditions' => array('id' => 2), 'recursive' => 3));
|
||||
$expected = array(
|
||||
'Portfolio' => array(
|
||||
'id' => 2,
|
||||
|
@ -5725,7 +5725,7 @@ class ModelReadTest extends BaseModelTest {
|
|||
$fullDebug = $this->db->fullDebug;
|
||||
$this->db->fullDebug = true;
|
||||
$TestModel->recursive = 6;
|
||||
$result = $TestModel->find(array('CategoryThread.id' => 7));
|
||||
$result = $TestModel->find('first', array('conditions' => array('CategoryThread.id' => 7)));
|
||||
|
||||
$expected = array(
|
||||
'CategoryThread' => array(
|
||||
|
@ -6007,12 +6007,12 @@ class ModelReadTest extends BaseModelTest {
|
|||
function testConditionalNumerics() {
|
||||
$this->loadFixtures('NumericArticle');
|
||||
$NumericArticle = new NumericArticle();
|
||||
$data = array('title' => '12345abcde');
|
||||
$result = $NumericArticle->find($data);
|
||||
$data = array('conditions' => array('title' => '12345abcde'));
|
||||
$result = $NumericArticle->find('first', $data);
|
||||
$this->assertTrue(!empty($result));
|
||||
|
||||
$data = array('title' => '12345');
|
||||
$result = $NumericArticle->find($data);
|
||||
$data = array('conditions' => array('title' => '12345'));
|
||||
$result = $NumericArticle->find('first', $data);
|
||||
$this->assertTrue(empty($result));
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
$result = $Article->save($data);
|
||||
$this->assertFalse(empty($result));
|
||||
|
||||
$testResult = $Article->find(array('Article.title' => 'Test Title'));
|
||||
$testResult = $Article->find('first', array('conditions' => array('Article.title' => 'Test Title')));
|
||||
|
||||
$this->assertEqual($testResult['Article']['title'], $data['Article']['title']);
|
||||
$this->assertEqual($testResult['Article']['created'], '2008-01-01 00:00:00');
|
||||
|
@ -1019,17 +1019,17 @@ class ModelWriteTest extends BaseModelTest {
|
|||
$Article = new Article();
|
||||
$result = $Article->save(Xml::build('<article title="test xml" user_id="5" />'));
|
||||
$this->assertFalse(empty($result));
|
||||
$results = $Article->find(array('Article.title' => 'test xml'));
|
||||
$results = $Article->find('first', array('conditions' => array('Article.title' => 'test xml')));
|
||||
$this->assertFalse(empty($results));
|
||||
|
||||
$result = $Article->save(Xml::build('<article><title>testing</title><user_id>6</user_id></article>'));
|
||||
$this->assertFalse(empty($result));
|
||||
$results = $Article->find(array('Article.title' => 'testing'));
|
||||
$results = $Article->find('first', array('conditions' => array('Article.title' => 'testing')));
|
||||
$this->assertFalse(empty($results));
|
||||
|
||||
$result = $Article->save(Xml::build('<article><title>testing with DOMDocument</title><user_id>7</user_id></article>', array('return' => 'domdocument')));
|
||||
$this->assertFalse(empty($result));
|
||||
$results = $Article->find(array('Article.title' => 'testing with DOMDocument'));
|
||||
$results = $Article->find('first', array('conditions' => array('Article.title' => 'testing with DOMDocument')));
|
||||
$this->assertFalse(empty($results));
|
||||
}
|
||||
|
||||
|
@ -1111,7 +1111,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
$this->assertFalse(empty($result));
|
||||
|
||||
$TestModel->unbindModel(array('belongsTo' => array('User'), 'hasMany' => array('Comment')));
|
||||
$result = $TestModel->find(array('Article.id' => 2), array('id', 'user_id', 'title', 'body'));
|
||||
$result = $TestModel->find('first', array('fields' => array('id', 'user_id', 'title', 'body'), 'conditions' => array('Article.id' => 2)));
|
||||
$expected = array(
|
||||
'Article' => array(
|
||||
'id' => '2',
|
||||
|
@ -1145,7 +1145,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'belongsTo' => array('User'),
|
||||
'hasMany' => array('Comment')
|
||||
));
|
||||
$result = $TestModel->find(array('Article.id'=>2), array('id', 'user_id', 'title', 'body'));
|
||||
$result = $TestModel->find('first', array('fields' => array('id', 'user_id', 'title', 'body'), 'conditions' => array('Article.id' => 2)));
|
||||
$expected = array(
|
||||
'Article' => array(
|
||||
'id' => '2',
|
||||
|
@ -1180,7 +1180,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'belongsTo' => array('User'),
|
||||
'hasMany' => array('Comment')
|
||||
));
|
||||
$result = $TestModel->find(array('Article.id' => 2), array('id', 'user_id', 'title', 'body'));
|
||||
$result = $TestModel->find('first', array('fields' => array('id', 'user_id', 'title', 'body'), 'conditions' => array('Article.id' => 2)));
|
||||
$expected = array(
|
||||
'Article' => array(
|
||||
'id' => '2',
|
||||
|
@ -1227,7 +1227,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'belongsTo' => array('User'),
|
||||
'hasMany' => array('Comment')
|
||||
));
|
||||
$result = $TestModel->find(array('Article.id'=>2), array('id', 'user_id', 'title', 'body'));
|
||||
$result = $TestModel->find('first', array('fields' => array('id', 'user_id', 'title', 'body'), 'conditions' => array('Article.id' => 2)));
|
||||
$expected = array(
|
||||
'Article' => array(
|
||||
'id' => '2',
|
||||
|
@ -1250,7 +1250,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'belongsTo' => array('User'),
|
||||
'hasMany' => array('Comment')
|
||||
));
|
||||
$result = $TestModel->find(array('Article.id'=>2), array('id', 'user_id', 'title', 'body'));
|
||||
$result = $TestModel->find('first', array('fields' => array('id', 'user_id', 'title', 'body'), 'conditions' => array('Article.id' => 2)));
|
||||
$expected = array(
|
||||
'Article' => array(
|
||||
'id' => '2',
|
||||
|
@ -1290,7 +1290,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'belongsTo' => array('User'),
|
||||
'hasMany' => array('Comment')
|
||||
));
|
||||
$result = $TestModel->find(array('Article.id'=>2), array('id', 'user_id', 'title', 'body'));
|
||||
$result = $TestModel->find('first', array('fields' => array('id', 'user_id', 'title', 'body'), 'conditions' => array('Article.id' => 2)));
|
||||
$expected = array(
|
||||
'Article' => array(
|
||||
'id' => '2',
|
||||
|
@ -1330,7 +1330,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'belongsTo' => array('User'),
|
||||
'hasMany' => array('Comment')
|
||||
));
|
||||
$result = $TestModel->find(array('Article.id'=>2), array('id', 'user_id', 'title', 'body'));
|
||||
$result = $TestModel->find('first', array('fields' => array('id', 'user_id', 'title', 'body'), 'conditions' => array('Article.id' => 2)));
|
||||
$expected = array(
|
||||
'Article' => array(
|
||||
'id' => '2',
|
||||
|
@ -1372,7 +1372,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'belongsTo' => array('User'),
|
||||
'hasMany' => array('Comment')
|
||||
));
|
||||
$result = $TestModel->find(array('Article.id'=>2), array('id', 'user_id', 'title', 'body'));
|
||||
$result = $TestModel->find('first', array('fields' => array('id', 'user_id', 'title', 'body'), 'conditions' => array('Article.id' => 2)));
|
||||
$expected = array(
|
||||
'Article' => array(
|
||||
'id' => '2',
|
||||
|
@ -1414,7 +1414,7 @@ class ModelWriteTest extends BaseModelTest {
|
|||
'belongsTo' => array('User'),
|
||||
'hasMany' => array('Comment')
|
||||
));
|
||||
$result = $TestModel->find(array('Article.id'=>2), array('id', 'user_id', 'title', 'body'));
|
||||
$result = $TestModel->find('first', array('fields' => array('id', 'user_id', 'title', 'body'), 'conditions' => array('Article.id' => 2)));
|
||||
$expected = array(
|
||||
'Article' => array(
|
||||
'id' => '2',
|
||||
|
|
Loading…
Add table
Reference in a new issue