/** * 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); }
/** * 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); }
/** * 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); }
/** * 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()); }
/** * 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); }