diff --git a/cake/tests/cases/libs/model/model.test.php b/cake/tests/cases/libs/model/model.test.php index 750fad482..39532ccd3 100644 --- a/cake/tests/cases/libs/model/model.test.php +++ b/cake/tests/cases/libs/model/model.test.php @@ -37,7 +37,6 @@ require_once dirname(__FILE__) . DS . 'models.php'; * @subpackage cake.tests.cases.libs.model */ class ModelTest extends CakeTestCase { - var $autoFixtures = false; var $fixtures = array( @@ -752,6 +751,7 @@ class ModelTest extends CakeTestCase { function testGenerateList() { $this->loadFixtures('Article', 'Apple', 'Post', 'Author', 'User'); + $this->model =& new Article(); $this->model->displayField = 'title'; @@ -808,6 +808,11 @@ class ModelTest extends CakeTestCase { $result = $this->model->find('list', array('fields' => array('User.user', 'User.password'))); $expected = array('mariano' => '5f4dcc3b5aa765d61d8327deb882cf99', 'nate' => '5f4dcc3b5aa765d61d8327deb882cf99', 'larry' => '5f4dcc3b5aa765d61d8327deb882cf99', 'garrett' => '5f4dcc3b5aa765d61d8327deb882cf99'); $this->assertEqual($result, $expected); + + $this->model =& new ModifiedAuthor(); + $result = $this->model->find('list', array('fields' => array('Author.id', 'Author.user'))); + $expected = array(1 => 'mariano (CakePHP)', 2 => 'nate (CakePHP)', 3 => 'larry (CakePHP)', 4 => 'garrett (CakePHP)'); + $this->assertEqual($result, $expected); } function testRecordExists() { diff --git a/cake/tests/cases/libs/model/models.php b/cake/tests/cases/libs/model/models.php index 4cfec73f8..81d3472df 100644 --- a/cake/tests/cases/libs/model/models.php +++ b/cake/tests/cases/libs/model/models.php @@ -289,6 +289,22 @@ class Author extends CakeTestModel { return $results; } } +/** + * Short description for class. + * + * @package cake.tests + * @subpackage cake.tests.cases.libs.model + */ +class ModifiedAuthor extends Author { + var $name = 'Author'; + + function afterFind($results) { + foreach($results as $index => $result) { + $results[$index]['Author']['user'] .= ' (CakePHP)'; + } + return $results; + } +} /** * Short description for class. *