Exemple #1
0
 function testExceptionHandling()
 {
     $r = new folksoResponse();
     $r->handleDBexception(new dbConnectionException('Something bad happened'));
     $r->prepareHeaders();
     $this->assertEqual($r->status, 500, 'dbConnectionException not handled correctly, no 500');
     $r2 = new folksoResponse();
     $r2->handleDBexception(new dbQueryException(234, 'select * from peeps', 'Something horrible just happened'));
     $r2->prepareHeaders();
     $this->assertEqual($r->status, 500, 'dbQueryException not producing a 500');
     $this->assertPattern('/peeps/', $r2->body(), 'Not getting correct exception information in body for query exception');
     $r3 = new folksoResponse();
     $r3->handleUserException(new badUseridException('Who are you?'));
     $this->assertEqual($r3->status, 403, 'Bad userid not returning 403');
 }