예제 #1
0
 public function testCode()
 {
     $this->assertEquals(302, $this->redirector->getCode(), 'Default code should be 302');
     $this->redirector->setCode(301);
     $this->assertEquals(301, $this->redirector->getCode());
     try {
         $this->redirector->setCode(251);
         $this->fail('Invalid redirect code should throw exception');
     } catch (Exception $e) {
     }
     try {
         $this->redirector->setCode(351);
         $this->fail('Invalid redirect code should throw exception');
     } catch (Exception $e) {
     }
 }
예제 #2
0
 public function testCodeAsAStringIsAllowed()
 {
     $this->redirector->setCode('303');
     $this->assertEquals(303, $this->redirector->getCode());
     try {
         $this->redirector->setCode('251');
         $this->fail('Invalid redirect code should throw exception');
     } catch (\Exception $e) {
     }
     try {
         $this->redirector->setCode('351');
         $this->fail('Invalid redirect code should throw exception');
     } catch (\Exception $e) {
     }
 }