當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Slim::router方法代碼示例

本文整理匯總了PHP中Slim::router方法的典型用法代碼示例。如果您正苦於以下問題:PHP Slim::router方法的具體用法?PHP Slim::router怎麽用?PHP Slim::router使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Slim的用法示例。


在下文中一共展示了Slim::router方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testDefaultInstanceProperties

 /**
  * Test default instance properties
  */
 public function testDefaultInstanceProperties()
 {
     $s = new Slim();
     $this->assertInstanceOf('Slim_Http_Request', $s->request());
     $this->assertInstanceOf('Slim_Http_Response', $s->response());
     $this->assertInstanceOf('Slim_Router', $s->router());
     $this->assertInstanceOf('Slim_View', $s->view());
     $this->assertInstanceOf('Slim_Log', $s->getLog());
     $this->assertEquals(Slim_Log::DEBUG, $s->getLog()->getLevel());
     $this->assertTrue($s->getLog()->getEnabled());
     $this->assertInstanceOf('Slim_Environment', $s->environment());
 }
開發者ID:raynaldmo,項目名稱:php-education,代碼行數:15,代碼來源:SlimTest.php

示例2: testSlimInit

 /**
  * Test Slim initialization
  *
  * Pre-conditions:
  * You have initialized a Slim application without specifying
  * a custom View class.
  *
  * Post-conditions:
  * Slim should have a default Not Found handler that is callable;
  * Slim should have a default Error hanlder that is callable;
  * Slim should have a default View
  */
 public function testSlimInit() {
     Slim::init();
     $this->assertTrue(is_callable(Slim::router()->notFound()));
     $this->assertTrue(is_callable(Slim::router()->error()));
     $this->assertTrue(Slim::view() instanceof Slim_View);
     $this->assertEquals('20 minutes', Slim::config('cookies.lifetime'));
 }
開發者ID:ntdt,項目名稱:Slim,代碼行數:19,代碼來源:SlimTest.php

示例3: testSlimInitialization

 /**
  * Test Slim initialization
  *
  * Pre-conditions:
  * You have initialized a Slim application
  *
  * Post-conditions:
  * Slim should have a default NotFound handler that is callable;
  * Slim should have a View
  */
 public function testSlimInitialization()
 {
     Slim::init();
     $this->assertTrue(is_callable(Slim::router()->notFound()));
     $this->assertTrue(Slim::view() instanceof View);
 }
開發者ID:kolanos,項目名稱:Slim,代碼行數:16,代碼來源:SlimTest.php

示例4: testGetCurrentRoute

 /**
  * Test get current route
  */
 public function testGetCurrentRoute()
 {
     Slim_Environment::mock(array('REQUEST_METHOD' => 'GET', 'SCRIPT_NAME' => '', 'PATH_INFO' => '/foo'));
     $app = new Slim();
     $route1 = $app->get('/bar', function () {
         echo "Bar";
     });
     $route2 = $app->get('/foo', function () {
         echo "Foo";
     });
     $app->call();
     $this->assertSame($route2, $app->router()->getCurrentRoute());
 }
開發者ID:sjakk,項目名稱:betatext,代碼行數:16,代碼來源:RouterTest.php

示例5: testSlimAccessors

 public function testSlimAccessors()
 {
     $app = new Slim();
     $this->assertTrue($app->request() instanceof Slim_Http_Request);
     $this->assertTrue($app->response() instanceof Slim_Http_Response);
     $this->assertTrue($app->router() instanceof Slim_Router);
 }
開發者ID:inscriptionweb,項目名稱:lebonmail,代碼行數:7,代碼來源:SlimTest.php


注:本文中的Slim::router方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。