mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 10:36:16 +00:00
Fixing tests that were passing by accident. The mockObjects array wasn't being appended to so tests were passing when they shouldn't have.
Fixing more failing tests.
This commit is contained in:
parent
09d357cc43
commit
c58f835d9b
1 changed files with 30 additions and 11 deletions
|
@ -176,6 +176,9 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
$this->Objects->load('TriggerMockFirst');
|
||||
$this->Objects->load('TriggerMockSecond');
|
||||
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockFirst;
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockSecond;
|
||||
|
||||
$this->Objects->TriggerMockFirst->expects($this->once())
|
||||
->method('callback')
|
||||
->will($this->returnValue(true));
|
||||
|
@ -196,6 +199,9 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
$this->Objects->load('TriggerMockFirst', array(), false);
|
||||
$this->Objects->load('TriggerMockSecond');
|
||||
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockFirst;
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockSecond;
|
||||
|
||||
$this->Objects->TriggerMockFirst->expects($this->once())
|
||||
->method('callback')
|
||||
->will($this->returnValue(true));
|
||||
|
@ -217,6 +223,9 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
$this->Objects->load('TriggerMockFirst');
|
||||
$this->Objects->load('TriggerMockSecond');
|
||||
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockFirst;
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockSecond;
|
||||
|
||||
$this->Objects->TriggerMockFirst->expects($this->once())
|
||||
->method('callback')
|
||||
->will($this->returnValue(true));
|
||||
|
@ -239,6 +248,9 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
$this->Objects->load('TriggerMockFirst');
|
||||
$this->Objects->load('TriggerMockSecond');
|
||||
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockFirst;
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockSecond;
|
||||
|
||||
$this->Objects->TriggerMockFirst->expects($this->once())
|
||||
->method('callback')
|
||||
->will($this->returnValue(array('one', 'two')));
|
||||
|
@ -264,6 +276,9 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
$this->Objects->load('TriggerMockFirst');
|
||||
$this->Objects->load('TriggerMockSecond');
|
||||
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockFirst;
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockSecond;
|
||||
|
||||
$this->Objects->TriggerMockFirst->expects($this->once())
|
||||
->method('callback')
|
||||
->will($this->returnValue(false));
|
||||
|
@ -288,6 +303,9 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
$this->Objects->load('TriggerMockFirst');
|
||||
$this->Objects->load('TriggerMockSecond');
|
||||
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockFirst;
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockSecond;
|
||||
|
||||
$this->Objects->TriggerMockFirst->expects($this->once())
|
||||
->method('callback')
|
||||
->with(array('value'))
|
||||
|
@ -317,15 +335,14 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
$this->Objects->load('TriggerMockFirst');
|
||||
$this->Objects->load('TriggerMockSecond');
|
||||
|
||||
$this->Objects->TriggerMockFirst->expects($this->once())
|
||||
->method('callback')
|
||||
->with(array('value'))
|
||||
->will($this->returnValue(array('new value')));
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockFirst;
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockSecond;
|
||||
|
||||
$this->Objects->TriggerMockSecond->expects($this->once())
|
||||
->method('callback')
|
||||
->with(array('value'))
|
||||
->will($this->returnValue(array('newer value')));
|
||||
$this->Objects->TriggerMockFirst->expects($this->never())
|
||||
->method('callback');
|
||||
|
||||
$this->Objects->TriggerMockSecond->expects($this->never())
|
||||
->method('callback');
|
||||
|
||||
$result = $this->Objects->trigger(
|
||||
'callback',
|
||||
|
@ -337,7 +354,6 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
/**
|
||||
* test that returrning null doesn't modify parameters.
|
||||
*
|
||||
* @expectedException CakeException
|
||||
* @return void
|
||||
*/
|
||||
function testTriggerModParamsNullIgnored() {
|
||||
|
@ -345,6 +361,9 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
$this->Objects->load('TriggerMockFirst');
|
||||
$this->Objects->load('TriggerMockSecond');
|
||||
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockFirst;
|
||||
$this->mockObjects[] = $this->Objects->TriggerMockSecond;
|
||||
|
||||
$this->Objects->TriggerMockFirst->expects($this->once())
|
||||
->method('callback')
|
||||
->with(array('value'))
|
||||
|
@ -358,9 +377,9 @@ class ObjectCollectionTest extends CakeTestCase {
|
|||
$result = $this->Objects->trigger(
|
||||
'callback',
|
||||
array(array('value')),
|
||||
array('modParams' => 2)
|
||||
array('modParams' => 0)
|
||||
);
|
||||
$this->assertEquals('new value', $result);
|
||||
$this->assertEquals(array('new value'), $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue