|
@@ 45-76 (lines=32) @@
|
| 42 |
|
/** |
| 43 |
|
* @test |
| 44 |
|
*/ |
| 45 |
|
public function shouldRenderTemplate() |
| 46 |
|
{ |
| 47 |
|
/** @var Request $request */ |
| 48 |
|
$request = $this->createMock(Request::class); |
| 49 |
|
|
| 50 |
|
/** @var Response $expectedResponse */ |
| 51 |
|
$expectedResponse = $this->createMock(Response::class); |
| 52 |
|
|
| 53 |
|
$this->argumentCompiler->expects($this->once())->method('buildArguments')->with( |
| 54 |
|
$this->equalTo(['foo' => 'bar']), |
| 55 |
|
$this->identicalTo($request) |
| 56 |
|
)->willReturn([ |
| 57 |
|
'bar' => 'baz' |
| 58 |
|
]); |
| 59 |
|
|
| 60 |
|
$this->controllerHelper->expects($this->once())->method('renderTemplate')->with( |
| 61 |
|
$this->equalTo("@foo/bar/baz.html"), |
| 62 |
|
$this->equalTo(['bar' => 'baz']) |
| 63 |
|
)->willReturn($expectedResponse); |
| 64 |
|
|
| 65 |
|
$controller = new GenericTemplateRenderController($this->controllerHelper, $this->argumentCompiler, [ |
| 66 |
|
'template' => "@foo/bar/baz.html", |
| 67 |
|
'arguments' => [ |
| 68 |
|
'foo' => 'bar' |
| 69 |
|
] |
| 70 |
|
]); |
| 71 |
|
|
| 72 |
|
/** @var Response $actualResponse */ |
| 73 |
|
$actualResponse = $controller->renderTemplate($request); |
| 74 |
|
|
| 75 |
|
$this->assertSame($expectedResponse, $actualResponse); |
| 76 |
|
} |
| 77 |
|
|
| 78 |
|
/** |
| 79 |
|
* @test |
|
@@ 136-169 (lines=34) @@
|
| 133 |
|
/** |
| 134 |
|
* @test |
| 135 |
|
*/ |
| 136 |
|
public function shouldBeCallableByInvokingController() |
| 137 |
|
{ |
| 138 |
|
/** @var Request $request */ |
| 139 |
|
$request = $this->createMock(Request::class); |
| 140 |
|
|
| 141 |
|
/** @var Response $expectedResponse */ |
| 142 |
|
$expectedResponse = $this->createMock(Response::class); |
| 143 |
|
|
| 144 |
|
$this->argumentCompiler->expects($this->once())->method('buildArguments')->with( |
| 145 |
|
$this->equalTo(['foo' => 'bar']), |
| 146 |
|
$this->identicalTo($request) |
| 147 |
|
)->willReturn([ |
| 148 |
|
'bar' => 'baz' |
| 149 |
|
]); |
| 150 |
|
|
| 151 |
|
$this->controllerHelper->expects($this->once())->method('renderTemplate')->with( |
| 152 |
|
$this->equalTo("@foo/bar/baz.html"), |
| 153 |
|
$this->equalTo(['bar' => 'baz']) |
| 154 |
|
)->willReturn($expectedResponse); |
| 155 |
|
|
| 156 |
|
$controller = new GenericTemplateRenderController($this->controllerHelper, $this->argumentCompiler, [ |
| 157 |
|
'template' => "@foo/bar/baz.html", |
| 158 |
|
'arguments' => [ |
| 159 |
|
'foo' => 'bar' |
| 160 |
|
] |
| 161 |
|
]); |
| 162 |
|
|
| 163 |
|
$this->controllerHelper->method('getCurrentRequest')->willReturn($request); |
| 164 |
|
|
| 165 |
|
/** @var Response $actualResponse */ |
| 166 |
|
$actualResponse = $controller(); |
| 167 |
|
|
| 168 |
|
$this->assertSame($expectedResponse, $actualResponse); |
| 169 |
|
} |
| 170 |
|
|
| 171 |
|
/** |
| 172 |
|
* @test |