|
@@ 16-31 (lines=16) @@
|
| 13 |
|
|
| 14 |
|
class CachedValueUnwrapperControllerTest extends PHPUnit_Framework_TestCase |
| 15 |
|
{ |
| 16 |
|
public function testAnyMethodWithCachedValue() |
| 17 |
|
{ |
| 18 |
|
$method = $this->getRandomMethod(); |
| 19 |
|
|
| 20 |
|
$innerControllerMock = $this->getMockBuilder('stdClass')->setMethods([$method])->getMock(); |
| 21 |
|
$controller = new CachedValueUnwrapperController($innerControllerMock); |
| 22 |
|
|
| 23 |
|
$value = new stdClass; |
| 24 |
|
|
| 25 |
|
$innerControllerMock |
| 26 |
|
->expects($this->once()) |
| 27 |
|
->method($method) |
| 28 |
|
->will($this->returnValue(new CachedValue($value))); |
| 29 |
|
|
| 30 |
|
$this->assertSame($value, $controller->$method()); |
| 31 |
|
} |
| 32 |
|
|
| 33 |
|
public function testAnyMethodWithoutCachedValue() |
| 34 |
|
{ |
|
@@ 33-48 (lines=16) @@
|
| 30 |
|
$this->assertSame($value, $controller->$method()); |
| 31 |
|
} |
| 32 |
|
|
| 33 |
|
public function testAnyMethodWithoutCachedValue() |
| 34 |
|
{ |
| 35 |
|
$method = $this->getRandomMethod(); |
| 36 |
|
|
| 37 |
|
$innerControllerMock = $this->getMockBuilder('stdClass')->setMethods([$method])->getMock(); |
| 38 |
|
$controller = new CachedValueUnwrapperController($innerControllerMock); |
| 39 |
|
|
| 40 |
|
$value = new stdClass; |
| 41 |
|
|
| 42 |
|
$innerControllerMock |
| 43 |
|
->expects($this->once()) |
| 44 |
|
->method($method) |
| 45 |
|
->will($this->returnValue($value)); |
| 46 |
|
|
| 47 |
|
$this->assertSame($value, $controller->$method()); |
| 48 |
|
} |
| 49 |
|
|
| 50 |
|
/** |
| 51 |
|
* @return string |