当前位置: 首页>>代码示例>>PHP>>正文


PHP PhpRenderer::resolver方法代码示例

本文整理汇总了PHP中Zend\View\Renderer\PhpRenderer::resolver方法的典型用法代码示例。如果您正苦于以下问题:PHP PhpRenderer::resolver方法的具体用法?PHP PhpRenderer::resolver怎么用?PHP PhpRenderer::resolver使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\View\Renderer\PhpRenderer的用法示例。


在下文中一共展示了PhpRenderer::resolver方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testCanSetResolverInstance

 public function testCanSetResolverInstance()
 {
     $resolver = new TemplatePathStack();
     $this->renderer->setResolver($resolver);
     $this->assertSame($resolver, $this->renderer->resolver());
     $this->assertSame($this->phpRenderer->resolver(), $this->renderer->resolver());
 }
开发者ID:wizzvet,项目名称:ZffHtml2pdf,代码行数:7,代码来源:Html2PdfRendererTest.php

示例2: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     $this->helper = new SnippetHelper();
     $view = new PhpRenderer();
     $view->resolver()->addPath(__DIR__ . '/../../../view');
     $view->resolver()->addPath(__DIR__ . '/_files/modules');
     $this->helper->setView($view);
 }
开发者ID:ripaclub,项目名称:zf2-hanger-snippet,代码行数:11,代码来源:SnippetHelperTest.php

示例3: setUp

 /**
  * Prepares the environment before running a test
  *
  */
 protected function setUp()
 {
     $cwd = __DIR__;
     // read navigation config
     $this->_files = $cwd . '/_files';
     $config = ConfigFactory::fromFile($this->_files . '/navigation.xml', true);
     // setup containers from config
     $this->_nav1 = new Navigation($config->get('nav_test1'));
     $this->_nav2 = new Navigation($config->get('nav_test2'));
     // setup view
     $view = new PhpRenderer();
     $view->resolver()->addPath($cwd . '/_files/mvc/views');
     // create helper
     $this->_helper = new $this->_helperName();
     $this->_helper->setView($view);
     // set nav1 in helper as default
     $this->_helper->setContainer($this->_nav1);
     // setup service manager
     $smConfig = array('modules' => array(), 'module_listener_options' => array('config_cache_enabled' => false, 'cache_dir' => 'data/cache', 'module_paths' => array(), 'extra_config' => array('service_manager' => array('factories' => array('Config' => function () use($config) {
         return array('navigation' => array('default' => $config->get('nav_test1')));
     })))));
     $sm = $this->serviceManager = new ServiceManager(new ServiceManagerConfig());
     $sm->setService('ApplicationConfig', $smConfig);
     $sm->get('ModuleManager')->loadModules();
     $sm->get('Application')->bootstrap();
     $sm->setFactory('Navigation', 'Zend\\Navigation\\Service\\DefaultNavigationFactory');
     $sm->setService('nav1', $this->_nav1);
     $sm->setService('nav2', $this->_nav2);
     $app = $this->serviceManager->get('Application');
     $app->getMvcEvent()->setRouteMatch(new RouteMatch(array('controller' => 'post', 'action' => 'view', 'id' => '1337')));
 }
开发者ID:razvansividra,项目名称:pnlzf2-1,代码行数:35,代码来源:AbstractTest.php

示例4: setUp

 public function setUp()
 {
     $view = new View();
     $base = str_replace('/', DIRECTORY_SEPARATOR, '/../_templates');
     $view->resolver()->addPath(__DIR__ . $base);
     $view->vars()->setStrictVars(true);
     $this->view = $view;
 }
开发者ID:razvansividra,项目名称:pnlzf2-1,代码行数:8,代码来源:DeclareVarsTest.php

示例5: getControllerConfig

 public function getControllerConfig()
 {
     return array('factories' => array('Modules\\Controller\\Console\\List' => function (ControllerManager $cm) {
         $sl = $cm->getServiceLocator();
         $renderer = new PhpRenderer();
         $renderer->resolver()->setPaths([__DIR__ . '/view']);
         return new Controller\Console\ListController(new ComposerInfo('composer.lock'), $sl->get('ModuleManager'), new ListViewModel(), $renderer);
     }, 'Modules\\Controller\\Console\\Init' => function (ControllerManager $cm) {
         $sl = $cm->getServiceLocator();
         return new Controller\Console\InitController($sl->get('Zend\\Db\\Adapter\\Adapter'), $sl->get('Zend\\Db\\Metadata\\Metadata'));
     }));
 }
开发者ID:t4web,项目名称:Modules,代码行数:12,代码来源:Module.php

示例6: _before

 public function _before(FunctionalTester $I)
 {
     $application = $I->getApplication();
     $this->event = $application->getMvcEvent();
     $this->routeMatch = new RouteMatch(array('controller' => 'Modules\\Controller\\Console\\List'));
     $this->event->setRouteMatch($this->routeMatch);
     $renderer = new PhpRenderer();
     $renderer->resolver()->setPaths([dirname(dirname(dirname(__DIR__))) . '/view']);
     $this->viewModel = new ListViewModel();
     $this->controller = new ListController(new ComposerInfo('composer.lock'), $application->getServiceManager()->get('Zend\\ModuleManager\\ModuleManager'), $this->viewModel, $renderer);
     $this->controller->setEvent($this->event);
     $this->controller->setEventManager($application->getEventManager());
     $this->controller->setServiceLocator($application->getServiceManager());
 }
开发者ID:t4web,项目名称:Modules,代码行数:14,代码来源:ListCest.php

示例7: getRenderer

 /**
  * 
  * @return \Zend\View\Renderer\PhpRenderer
  */
 public function getRenderer()
 {
     if ($this->renderer === null) {
         $renderer = new PhpRenderer();
         // register view helpers
         $formHelperConfig = new ZendFormHelperConfig();
         $formHelperConfig->configureServiceManager($renderer->getHelperPluginManager());
         // register view helpers
         $formHelperConfig = new FormHelperConfig();
         $formHelperConfig->configureServiceManager($renderer->getHelperPluginManager());
         // set base path
         $path = $this->templatePath ?: __DIR__ . '/view/scripts';
         $renderer->resolver()->addPath($path);
         $this->setRenderer($renderer);
     }
     return $this->renderer;
 }
开发者ID:rb-cohen,项目名称:jzform,代码行数:21,代码来源:RenderAbstract.php

示例8: setUp

 /**
  * Prepares the environment before running a test
  *
  */
 protected function setUp()
 {
     $cwd = __DIR__;
     // read navigation config
     $this->_files = $cwd . '/_files';
     $config = ConfigFactory::fromFile($this->_files . '/navigation.xml', true);
     // setup containers from config
     $this->_nav1 = new Navigation($config->get('nav_test1'));
     $this->_nav2 = new Navigation($config->get('nav_test2'));
     // setup view
     $view = new PhpRenderer();
     $view->resolver()->addPath($cwd . '/_files/mvc/views');
     // create helper
     $this->_helper = new $this->_helperName();
     $this->_helper->setView($view);
     // set nav1 in helper as default
     $this->_helper->setContainer($this->_nav1);
 }
开发者ID:rikaix,项目名称:zf2,代码行数:22,代码来源:AbstractTest.php

示例9: addPath

 /**
  * Add path in Zend\View\Resolver\TemplatePathStack
  *
  * @param string $dir Directory
  *
  * @return \Gc\View\Renderer
  */
 public function addPath($dir)
 {
     $this->checkRenderer();
     $this->renderer->resolver()->addPath($dir);
     return $this;
 }
开发者ID:gotcms,项目名称:gotcms,代码行数:13,代码来源:Renderer.php

示例10: testRendersWithPartial

 public function testRendersWithPartial()
 {
     $view = new View\Renderer\PhpRenderer();
     $view->resolver()->addPath(__DIR__ . '/_files/scripts');
     Helper\PaginationControl::setDefaultViewPartial('partial.phtml');
     $this->paginator->setView($view);
     $string = $this->paginator->__toString();
     $this->assertEquals('partial rendered successfully', $string);
 }
开发者ID:rajanlamic,项目名称:IntTest,代码行数:9,代码来源:PaginatorTest.php

示例11: testShouldNotConvertToArrayRecursivelyIfModelIsTraversable

 public function testShouldNotConvertToArrayRecursivelyIfModelIsTraversable()
 {
     $rIterator = new RecursiveIteratorTest();
     for ($i = 0; $i < 5; ++$i) {
         $data = array('message' => 'foo' . $i);
         $rIterator->addItem(new IteratorTest($data));
     }
     $view = new View();
     $view->resolver()->addPath($this->basePath . '/application/views/scripts');
     $this->helper->setView($view);
     $this->helper->setObjectKey('obj');
     $result = $this->helper->__invoke('partialLoopShouldNotConvertToArrayRecursively.phtml', $rIterator);
     foreach ($rIterator as $item) {
         foreach ($item as $key => $value) {
             $this->assertContains('This is an iteration: ' . $value, $result, var_export($value, 1));
         }
     }
 }
开发者ID:pnaq57,项目名称:zf2demo,代码行数:18,代码来源:PartialLoopTest.php

示例12: testCanPassViewModelAsSoleArgument

 public function testCanPassViewModelAsSoleArgument()
 {
     $model = new ViewModel(array('foo' => 'bar', 'bar' => 'baz'));
     $model->setTemplate('partialVars.phtml');
     $view = new View();
     $view->resolver()->addPath($this->basePath . '/application/views/scripts');
     $this->helper->setView($view);
     $return = $this->helper->__invoke($model);
     foreach ($model->getVariables() as $key => $value) {
         $string = sprintf('%s: %s', $key, $value);
         $this->assertContains($string, $return);
     }
 }
开发者ID:rcastardo,项目名称:zf2,代码行数:13,代码来源:PartialTest.php

示例13: testPartialLoopPartialCounterResets

 /**
  * @group ZF-5174
  */
 public function testPartialLoopPartialCounterResets()
 {
     $data = array(array('message' => 'foo'), array('message' => 'bar'), array('message' => 'baz'), array('message' => 'bat'));
     $view = new View();
     $view->resolver()->addPath($this->basePath . '/application/views/scripts');
     $this->helper->setView($view);
     $result = $this->helper->__invoke('partialLoopCouter.phtml', $data);
     foreach ($data as $key => $item) {
         $string = 'This is an iteration: ' . $item['message'] . ', pointer at ' . ($key + 1);
         $this->assertContains($string, $result);
     }
     $result = $this->helper->__invoke('partialLoopCouter.phtml', $data);
     foreach ($data as $key => $item) {
         $string = 'This is an iteration: ' . $item['message'] . ', pointer at ' . ($key + 1);
         $this->assertContains($string, $result);
     }
 }
开发者ID:navassouza,项目名称:zf2,代码行数:20,代码来源:PartialLoopTest.php

示例14: setUp

 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 protected function setUp()
 {
     $this->view = ViewModel::fromArray(array('name' => 'View Name', 'identifier' => 'View identifier', 'description' => 'View Description', 'content' => 'View Content'));
     $this->view->save();
     $this->layout = LayoutModel::fromArray(array('name' => 'Layout Name', 'identifier' => 'Layout identifier', 'description' => 'Layout Description', 'content' => 'Layout Content'));
     $this->layout->save();
     $this->user = UserModel::fromArray(array('lastname' => 'User test', 'firstname' => 'User test', 'email' => 'pierre.rambaud86@gmail.com', 'login' => 'test', 'user_acl_role_id' => 1));
     $this->user->setPassword('test');
     $this->user->save();
     $this->documentType = DocumentTypeModel::fromArray(array('name' => 'Document Type Name', 'description' => 'Document Type description', 'icon_id' => 1, 'defaultview_id' => $this->view->getId(), 'user_id' => $this->user->getId()));
     $this->documentType->save();
     $this->document = DocumentModel::fromArray(array('name' => 'Document name', 'url_key' => 'url-key', 'status' => DocumentModel::STATUS_ENABLE, 'show_in_nav' => true, 'user_id' => $this->user->getId(), 'document_type_id' => $this->documentType->getId(), 'view_id' => $this->view->getId(), 'layout_id' => $this->layout->getId(), 'parent_id' => 0));
     $this->document->save();
     $this->object = new Documents();
     $view = new View();
     $view->resolver()->addPath(__DIR__ . '/_files/views');
     $view->setHelperPluginManager(Registry::get('Application')->getServiceManager()->get('viewhelpermanager'));
     $this->object->setView($view);
 }
开发者ID:gotcms,项目名称:gotcms,代码行数:25,代码来源:DocumentsTest.php

示例15: testGetDocument

 /**
  * Test
  *
  * @return void
  */
 public function testGetDocument()
 {
     $parent = new ViewModel();
     $parent->setTemplate('layout');
     $view = new View();
     $renderer = Registry::get('Application')->getServiceManager()->get('Zend\\View\\Renderer\\PhpRenderer');
     $view->setHelperPluginManager($renderer->getHelperPluginManager());
     $view->plugin('view_model')->setRoot($parent);
     $view->resolver()->addPath(__DIR__ . '/_files/views');
     $this->object->setView($view);
     $this->assertInstanceOf('Gc\\Document\\Model', $this->object->getDocument());
 }
开发者ID:gotcms,项目名称:gotcms,代码行数:17,代码来源:ScriptTest.php


注:本文中的Zend\View\Renderer\PhpRenderer::resolver方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。