Skip to content

Commit

Permalink
Properly setUp and tearDown HTTPTest
Browse files Browse the repository at this point in the history
Initialize `Request::$initial` for HTTPTest::test_redirect.

After initializing `Request::$initial`, it is probably better to set it
to `NULL` instead of using `$this->_initial_request` to temporary save
the value. But I prefered to keep things in conformity with
`RequestTest` for the time being.
  • Loading branch information
enov committed Jul 22, 2015
1 parent 70b88e8 commit c37cf6f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/kohana/HTTPTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
class Kohana_HTTPTest extends Unittest_TestCase {

protected $_inital_request;

/**
* Sets up the environment
*/
Expand All @@ -24,8 +26,21 @@ public function setUp()
{
parent::setUp();
Kohana::$config->load('url')->set('trusted_hosts', array('www\.example\.com'));
$this->_initial_request = Request::$initial;
Request::$initial = new Request('/');
}

/**
* Tears down whatever is setUp
*/
// @codingStandardsIgnoreStart
public function tearDown()
// @codingStandardsIgnoreEnd
{
Request::$initial = $this->_initial_request;
parent::tearDown();
}
// @codingStandardsIgnoreStart

/**
* Defaults for this test
Expand Down

0 comments on commit c37cf6f

Please sign in to comment.