The default configuration is:
Look for .php, .blade.php files; default layout "default"; no default subtemplate;
look only for the specified view; do NOT fall back to the default layout or subtemplate;
look for templates ONLY in site or admin, depending on where we're running from
public viewFinder ( |
||
$view | The view this view template finder will be attached to | |
$config | array | Configuration variables for the object |
return | mixed |
/** * Creates a view template finder object for a specific View. * * The default configuration is: * Look for .php, .blade.php files; default layout "default"; no default subtemplate; * look for both pluralised and singular views; fall back to the default layout without subtemplate; * look for templates in both site and admin * * @param View $view The view this view template finder will be attached to * @param array $config Configuration variables for the object * * @return mixed */ public function viewFinder(View $view, array $config = array()) { // Initialise the configuration with the default values $defaultConfig = array('extensions' => array('.php', '.blade.php'), 'defaultLayout' => 'default', 'defaultTpl' => '', 'strictView' => false, 'strictTpl' => false, 'strictLayout' => false, 'sidePrefix' => 'any'); $config = array_merge($defaultConfig, $config); return parent::viewFinder($view, $config); }
/** * @group BasicFactory * @covers FOF30\Factory\BasicFactory::viewFinder */ public function testViewFinder() { $msg = 'BasicFactory::viewFinder %s'; $configuration = $this->getMock('FOF30\\Configuration\\Configuration', array('get'), array(), '', false); $configuration->expects($this->any())->method('get')->willReturnCallback(function ($key, $default) { return $default; }); $container = new TestContainer(array('appConfig' => $configuration)); $platform = $container->platform; $platform::$template = 'fake_test_template'; $platform::$uriBase = 'www.example.com'; $view = new ViewStub($container); $factory = new BasicFactory($container); $result = $factory->viewFinder($view, array()); // I can only test if the correct object is passed, since we are simply collecting all the data // and passing it to the ViewTemplateFinder constructor $this->assertEquals('FOF30\\View\\ViewTemplateFinder', get_class($result), sprintf($msg, 'Returned the wrong result')); }