-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/new-phpunit' into develop
- Loading branch information
Showing
4 changed files
with
65 additions
and
4 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
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,47 @@ | ||
<?php | ||
/** | ||
* JBZoo Http-Client | ||
* | ||
* This file is part of the JBZoo CCK package. | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @package Http-Client | ||
* @license MIT | ||
* @copyright Copyright (C) JBZoo.com, All rights reserved. | ||
* @link https://github.com/JBZoo/Http-Client | ||
*/ | ||
|
||
namespace JBZoo\PHPUnit; | ||
|
||
use JBZoo\HttpClient\Response; | ||
|
||
/** | ||
* Class ResponseTest | ||
* @package JBZoo\PHPUnit | ||
*/ | ||
class ResponseTest extends PHPUnit | ||
{ | ||
protected $_json = '{"key-1":"value-1","key-2":"value-2"}'; | ||
|
||
public function testGetSameJSON() | ||
{ | ||
$resp = new Response(); | ||
|
||
$resp->setBody($this->_json); | ||
|
||
$json1 = $resp->getJSON(); | ||
$json2 = $resp->getJSON(); | ||
|
||
isSame('value-1', $resp->getJSON()->get('key-1')); | ||
isSame('value-2', $resp->getJSON()->find('key-2')); | ||
isSame($json1, $json2); | ||
isSame($json1, $resp->getJSON()); | ||
isSame($json2, $resp->getJSON()); | ||
|
||
$resp->setBody($this->_json); | ||
isNotSame($json1, $resp->getJSON()); | ||
isNotSame($json2, $resp->getJSON()); | ||
isSame($resp->getJSON(), $resp->getJSON()); | ||
} | ||
} |