mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-06-05 14:23:36 +00:00
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 #2341
This commit is contained in:
parent
81d7ef46c5
commit
b4faa00703
2 changed files with 19 additions and 4 deletions
lib/Cake/Test/Case/Model
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue