Skip to content

Commit c37cf6f

Browse files
committed
Properly setUp and tearDown HTTPTest
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.
1 parent 70b88e8 commit c37cf6f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/kohana/HTTPTest.php

+15
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
class Kohana_HTTPTest extends Unittest_TestCase {
1717

18+
protected $_inital_request;
19+
1820
/**
1921
* Sets up the environment
2022
*/
@@ -24,8 +26,21 @@ public function setUp()
2426
{
2527
parent::setUp();
2628
Kohana::$config->load('url')->set('trusted_hosts', array('www\.example\.com'));
29+
$this->_initial_request = Request::$initial;
30+
Request::$initial = new Request('/');
2731
}
2832

33+
/**
34+
* Tears down whatever is setUp
35+
*/
36+
// @codingStandardsIgnoreStart
37+
public function tearDown()
38+
// @codingStandardsIgnoreEnd
39+
{
40+
Request::$initial = $this->_initial_request;
41+
parent::tearDown();
42+
}
43+
// @codingStandardsIgnoreStart
2944

3045
/**
3146
* Defaults for this test

0 commit comments

Comments
 (0)