Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Starting to implement Response object.
- Loading branch information
Showing
2 changed files
with
208 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<?php | ||
/** | ||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) | ||
* Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) | ||
* | ||
* Licensed under The MIT License | ||
* Redistributions of files must retain the above copyright notice. | ||
* | ||
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) | ||
* @link http://cakephp.org CakePHP(tm) Project | ||
* @since CakePHP(tm) v 3.0.0 | ||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) | ||
*/ | ||
namespace Cake\Test\TestCase\Network\Http; | ||
|
||
use Cake\Network\Http\Response; | ||
use Cake\TestSuite\TestCase; | ||
|
||
/** | ||
* HTTP response test. | ||
*/ | ||
class ResponseTest extends TestCase { | ||
|
||
public function testHeaderParsing() { | ||
$this->markTestIncomplete(); | ||
} | ||
|
||
public function testContent() { | ||
$this->markTestIncomplete(); | ||
} | ||
|
||
/** | ||
* Test isOk() | ||
* | ||
* @return void | ||
*/ | ||
public function testIsOk() { | ||
$headers = [ | ||
'HTTP/1.1 200 OK', | ||
'Content-Type: text/html' | ||
]; | ||
$response = new Response($headers, 'ok'); | ||
$this->assertTrue($response->isOk()); | ||
|
||
$headers = [ | ||
'HTTP/1.1 301 Moved Permanently', | ||
'Content-Type: text/html' | ||
]; | ||
$response = new Response($headers, ''); | ||
$this->assertFalse($response->isOk()); | ||
|
||
$headers = [ | ||
'HTTP/1.0 404 Not Found', | ||
'Content-Type: text/html' | ||
]; | ||
$response = new Response($headers, ''); | ||
$this->assertFalse($response->isOk()); | ||
} | ||
|
||
/** | ||
* Test isRedirect() | ||
* | ||
* @return void | ||
*/ | ||
public function testIsRedirect() { | ||
$headers = [ | ||
'HTTP/1.1 200 OK', | ||
'Content-Type: text/html' | ||
]; | ||
$response = new Response($headers, 'ok'); | ||
$this->assertFalse($response->isRedirect()); | ||
|
||
$headers = [ | ||
'HTTP/1.1 301 Moved Permanently', | ||
'Location: /', | ||
'Content-Type: text/html' | ||
]; | ||
$response = new Response($headers, ''); | ||
$this->assertTrue($response->isRedirect()); | ||
|
||
$headers = [ | ||
'HTTP/1.0 404 Not Found', | ||
'Content-Type: text/html' | ||
]; | ||
$response = new Response($headers, ''); | ||
$this->assertFalse($response->isRedirect()); | ||
} | ||
|
||
public function testCookie() { | ||
$this->markTestIncomplete(); | ||
} | ||
|
||
public function testStatusCode() { | ||
$this->markTestIncomplete(); | ||
} | ||
|
||
public function testEncoding() { | ||
$this->markTestIncomplete(); | ||
} | ||
|
||
} |