|
22 | 22 | use Zend\Expressive\ZendView\UrlHelper; |
23 | 23 | use Zend\Expressive\ZendView\ZendViewRenderer; |
24 | 24 | use Zend\Expressive\ZendView\ZendViewRendererFactory; |
| 25 | +use Zend\Expressive\ZendView\NamespacedPathStackResolver; |
25 | 26 | use Zend\View\HelperPluginManager; |
26 | 27 | use Zend\View\Model\ModelInterface; |
27 | 28 | use Zend\View\Renderer\PhpRenderer; |
@@ -201,14 +202,18 @@ public function testConfiguresPaths() |
201 | 202 | $this->assertPathNamespaceCount(3, null, $paths); |
202 | 203 |
|
203 | 204 | $dirSlash = DIRECTORY_SEPARATOR; |
204 | | - // @codingStandardsIgnoreStart |
205 | | - $this->assertPathNamespaceContains(__DIR__ . '/TestAsset/bar' . $dirSlash, 'foo', $paths, var_export($paths, true)); |
| 205 | + |
| 206 | + $this->assertPathNamespaceContains( |
| 207 | + __DIR__ . '/TestAsset/bar' . $dirSlash, |
| 208 | + 'foo', |
| 209 | + $paths, |
| 210 | + var_export($paths, true) |
| 211 | + ); |
206 | 212 | $this->assertPathNamespaceContains(__DIR__ . '/TestAsset/baz' . $dirSlash, 'bar', $paths); |
207 | 213 | $this->assertPathNamespaceContains(__DIR__ . '/TestAsset/bat' . $dirSlash, 'bar', $paths); |
208 | 214 | $this->assertPathNamespaceContains(__DIR__ . '/TestAsset/one' . $dirSlash, null, $paths); |
209 | 215 | $this->assertPathNamespaceContains(__DIR__ . '/TestAsset/two' . $dirSlash, null, $paths); |
210 | 216 | $this->assertPathNamespaceContains(__DIR__ . '/TestAsset/three' . $dirSlash, null, $paths); |
211 | | - // @codingStandardsIgnoreEnd |
212 | 217 | } |
213 | 218 |
|
214 | 219 | public function testConfiguresTemplateMap() |
@@ -247,6 +252,34 @@ public function testConfiguresTemplateMap() |
247 | 252 | $this->assertEquals('baz', $resolver->get('bar')); |
248 | 253 | } |
249 | 254 |
|
| 255 | + public function testConfiguresCustomDefaultSuffix() |
| 256 | + { |
| 257 | + $config = [ |
| 258 | + 'templates' => [ |
| 259 | + 'default_suffix' => 'php', |
| 260 | + ], |
| 261 | + ]; |
| 262 | + |
| 263 | + $this->container->has('config')->willReturn(true); |
| 264 | + $this->container->get('config')->willReturn($config); |
| 265 | + $this->container->has(HelperPluginManager::class)->willReturn(false); |
| 266 | + $this->container->has(PhpRenderer::class)->willReturn(false); |
| 267 | + |
| 268 | + $factory = new ZendViewRendererFactory(); |
| 269 | + $view = $factory($this->container->reveal()); |
| 270 | + |
| 271 | + $r = new ReflectionProperty($view, 'resolver'); |
| 272 | + $r->setAccessible(true); |
| 273 | + $resolver = $r->getValue($view); |
| 274 | + |
| 275 | + $this->assertInstanceOf( |
| 276 | + NamespacedPathStackResolver::class, |
| 277 | + $resolver, |
| 278 | + 'Expected NamespacedPathStackResolver not found!' |
| 279 | + ); |
| 280 | + $this->assertEquals('php', $resolver->getDefaultSuffix()); |
| 281 | + } |
| 282 | + |
250 | 283 | public function testInjectsCustomHelpersIntoHelperManager() |
251 | 284 | { |
252 | 285 | $this->container->has('config')->willReturn(false); |
|
0 commit comments