本文整理汇总了PHP中Slim::status方法的典型用法代码示例。如果您正苦于以下问题:PHP Slim::status方法的具体用法?PHP Slim::status怎么用?PHP Slim::status使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Slim
的用法示例。
在下文中一共展示了Slim::status方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSlimStatus
/**
* Test Slim::status
*
* Pre-conditions:
* You have initialized a Slim app and set the status code.
*
* Post-conditions:
* The Response status code is set correctly.
*/
public function testSlimStatus(){
Slim::init();
Slim::status(302);
$this->assertSame(Slim::response()->status(), 302);
$this->setExpectedException('InvalidArgumentException');
Slim::init();
Slim::status(900);
}
示例2: testSlimStatusHelperSetsResponseStatusCode
/**
* Test Slim sets status code
*
* Pre-conditions:
* You have initialized a Slim app and set the status code.
*
* Post-conditions:
* The Response status code is set correctly.
*/
public function testSlimStatusHelperSetsResponseStatusCode()
{
Slim::init();
Slim::status(302);
$this->assertSame(Slim::response()->status(), 302);
}
示例3: testSlimStatus
/**
* Test Slim::status
*
* Pre-conditions:
* Slim app instantiated;
* Case A: Valid HTTP status is set using helper method;
* Case B: Invalid HTTP status is set using helper method;
*
* Post-conditions:
* Case A: The Response status code is set correctly;
* Case B: InvalidArgumentException is thrown;
*/
public function testSlimStatus()
{
$app1 = new Slim();
//Case A
$app1->status(302);
$this->assertSame($app1->response()->status(), 302);
//Case B
$this->setExpectedException('InvalidArgumentException');
$app2 = new Slim();
$app2->status(900);
}
示例4: testStatus
/**
* Test status
*/
public function testStatus()
{
$s = new Slim();
$s->get('/bar', function () use($s) {
$s->status(403);
});
$s->call();
$this->assertEquals(403, $s->response()->status());
}
示例5: testStatus
/**
* Test status
*/
public function testStatus()
{
$s = new Slim();
$s->get('/bar', function () use($s) {
$s->status(403);
});
$env = $s->environment();
list($status, $header, $body) = $s->call($env);
$this->assertEquals(403, $status);
}