Adding error to find(threaded).

When the model has no parent_id trigger a warning about the impending
failure and return an empty result.

Fixes 
This commit is contained in:
mark_story 2012-01-02 13:46:35 -05:00
parent 81d7ef46c5
commit b4faa00703
2 changed files with 19 additions and 4 deletions
lib/Cake/Test/Case/Model

View file

@ -2987,13 +2987,21 @@ class ModelReadTest extends BaseModelTest {
$noAfterFindData = $noAfterFindModel->find('all');
$this->assertFalse($afterFindModel == $noAfterFindModel);
// Limitation of PHP 4 and PHP 5 > 5.1.6 when comparing recursive objects
if (PHP_VERSION === '5.1.6') {
$this->assertFalse($afterFindModel != $duplicateModel);
}
$this->assertEquals($afterFindData, $noAfterFindData);
}
/**
* find(threaded) should trigger errors whne there is no parent_id field.
*
* @expectedException PHPUnit_Framework_Error_Warning
* @return void
*/
public function testFindThreadedError() {
$this->loadFixtures('Apple', 'Sample');
$Apple = new Apple();
$Apple->find('threaded');
}
/**
* testFindAllThreaded method
*