本文整理汇总了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());
}
示例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'));
}
示例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);
}
示例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());
}
示例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);
}