コード例 #1
0
ファイル: PartTest.php プロジェクト: nsenkevich/zf2
 public function getRoute()
 {
     $routeBroker = new RouteBroker();
     $routeBroker->getClassLoader()->registerPlugins(array('literal' => 'Zend\\Mvc\\Router\\Http\\Literal', 'regex' => 'Zend\\Mvc\\Router\\Http\\Regex', 'segment' => 'Zend\\Mvc\\Router\\Http\\Segment', 'wildcard' => 'Zend\\Mvc\\Router\\Http\\Wildcard', 'hostname' => 'Zend\\Mvc\\Router\\Http\\Hostname', 'scheme' => 'Zend\\Mvc\\Router\\Http\\Scheme', 'part' => 'Zend\\Mvc\\Router\\Http\\Part'));
     $route = Part::factory(array('route' => array('type' => 'literal', 'options' => array('route' => '/', 'defaults' => array('controller' => 'ItsHomePage'))), 'may_terminate' => true, 'route_broker' => $routeBroker, 'child_routes' => array('blog' => array('type' => 'literal', 'options' => array('route' => 'blog', 'defaults' => array('controller' => 'ItsBlog')), 'may_terminate' => true, 'child_routes' => array('rss' => array('type' => 'literal', 'options' => array('route' => '/rss', 'defaults' => array('controller' => 'ItsRssBlog')), 'child_routes' => array('sub' => array('type' => 'literal', 'options' => array('route' => '/sub', 'defaults' => array('action' => 'ItsSubRss'))))))), 'forum' => array('type' => 'literal', 'options' => array('route' => 'forum', 'defaults' => array('controller' => 'ItsForum'))), 'foo' => array('type' => 'segment', 'options' => array('route' => 'foo/:foo', 'defaults' => array('controller' => 'ItsFoo')), 'child_routes' => array('wildcard' => array('type' => 'wildcard'))))));
     return $route;
 }
コード例 #2
0
ファイル: PartTest.php プロジェクト: rikh42/zf2
 public static function getRoute()
 {
     $routeBroker = new RouteBroker();
     $routeBroker->getClassLoader()->registerPlugins(array('part' => 'Zend\\Mvc\\Router\\Http\\Part'));
     return new Part(array('type' => 'Zend\\Mvc\\Router\\Http\\Literal', 'options' => array('route' => '/foo', 'defaults' => array('controller' => 'foo'))), true, $routeBroker, array('bar' => array('type' => 'Zend\\Mvc\\Router\\Http\\Literal', 'options' => array('route' => '/bar', 'defaults' => array('controller' => 'bar'))), 'baz' => array('type' => 'Zend\\Mvc\\Router\\Http\\Literal', 'options' => array('route' => '/baz'), 'child_routes' => array('bat' => array('type' => 'Zend\\Mvc\\Router\\Http\\Segment', 'options' => array('route' => '/:controller'), 'may_terminate' => true, 'child_routes' => array('wildcard' => array('type' => 'Zend\\Mvc\\Router\\Http\\Wildcard'))))), 'bat' => array('type' => 'Zend\\Mvc\\Router\\Http\\Segment', 'options' => array('route' => '/bat[/:foo]', 'defaults' => array('foo' => 'bar')), 'may_terminate' => true, 'child_routes' => array('literal' => array('type' => 'Zend\\Mvc\\Router\\Http\\Literal', 'options' => array('route' => '/bar'))))));
 }
コード例 #3
0
ファイル: RouteBrokerTest.php プロジェクト: bradley-holt/zf2
 public function testSetClassLoaderViaOptionsAsArray()
 {
     $broker = new RouteBroker(array('class_loader' => array('class' => 'Zend\\Loader\\PluginClassLoader', 'options' => array(), 'foo' => 'bar')));
     $this->assertInstanceOf('Zend\\Loader\\PluginClassLoader', $broker->getClassLoader());
 }