Kohana v3.3.5
This commit is contained in:
@@ -17,6 +17,30 @@
|
||||
*/
|
||||
class Kohana_Request_Client_InternalTest extends Unittest_TestCase
|
||||
{
|
||||
|
||||
protected $_log_object;
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
public function setUp()
|
||||
// @codingStandardsIgnoreEnd
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
// temporarily save $log object
|
||||
$this->_log_object = Kohana::$log;
|
||||
Kohana::$log = NULL;
|
||||
}
|
||||
|
||||
// @codingStandardsIgnoreStart
|
||||
public function tearDown()
|
||||
// @codingStandardsIgnoreEnd
|
||||
{
|
||||
// re-assign log object
|
||||
Kohana::$log = $this->_log_object;
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function provider_response_failure_status()
|
||||
{
|
||||
return array(
|
||||
@@ -37,7 +61,7 @@ class Kohana_Request_Client_InternalTest extends Unittest_TestCase
|
||||
public function test_response_failure_status($directory, $controller, $action, $uri, $expected)
|
||||
{
|
||||
// Mock for request object
|
||||
$request = $this->getMock('Request', array('directory', 'controller', 'action', 'uri', 'response'), array($uri));
|
||||
$request = $this->getMock('Request', array('directory', 'controller', 'action', 'uri', 'response', 'method'), array($uri));
|
||||
|
||||
$request->expects($this->any())
|
||||
->method('directory')
|
||||
@@ -59,10 +83,15 @@ class Kohana_Request_Client_InternalTest extends Unittest_TestCase
|
||||
->method('response')
|
||||
->will($this->returnValue($this->getMock('Response')));
|
||||
|
||||
// mock `method` method to avoid fatals in newer versions of PHPUnit
|
||||
$request->expects($this->any())
|
||||
->method('method')
|
||||
->withAnyParameters();
|
||||
|
||||
$internal_client = new Request_Client_Internal;
|
||||
|
||||
$response = $internal_client->execute($request);
|
||||
|
||||
$this->assertSame($expected, $response->status());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user