예제 #1
0
파일: SlimTest.php 프로젝트: ntdt/Slim
    /**
     * 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
0
파일: SlimTest.php 프로젝트: kolanos/Slim
 /**
  * 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
0
 /**
  * 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
0
파일: SlimTest.php 프로젝트: rs3d/Slimplr
 /**
  * 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
0
 /**
  * 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);
 }