Exemple #1
0
 /**
  * Static method for initialization with MVC support
  *
  * @param  string|array|\Zend\Config\Config $options
  * @return \Zend\Layout\Layout
  */
 public static function startMvc($options = null)
 {
     if (null === self::$_mvcInstance) {
         self::$_mvcInstance = new self($options, true);
     }
     if (is_string($options)) {
         self::$_mvcInstance->setLayoutPath($options);
     } elseif (is_array($options) || $options instanceof Config\Config) {
         self::$_mvcInstance->setOptions($options);
     }
     return self::$_mvcInstance;
 }
Exemple #2
0
 public function testRenderWithCustomInflection()
 {
     $layout = new Layout\Layout();
     $view = new View\PhpRenderer();
     $layout->setLayoutPath(__DIR__ . '/_files/layouts')->setView($view);
     $inflector = $layout->getInflector();
     $inflector->setTarget('test/:script.:suffix')->setStaticRule('suffix', 'php');
     $layout->message = 'Rendered layout';
     $received = $layout->render();
     $this->assertContains('Testing layouts with custom inflection:', $received);
     $this->assertContains($layout->message, $received);
 }