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) { } }
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) { } }