This repository has been archived by the owner on Jan 26, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tagging version v0.1.0 vv0.1.0
- Loading branch information
Showing
10 changed files
with
174 additions
and
71 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ config/ | |
vendor/ | ||
composer.lock | ||
tests/LooplineSystems/CloseIoApi/Api/LiveApiTest.php | ||
tests/build/logs/ |
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
19 changes: 0 additions & 19 deletions
19
src/LooplineSystems/CloseIoApiWrapper/Library/Curl/CurlConstantsInterface.php
This file was deleted.
Oops, something went wrong.
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,80 @@ | ||
<?php | ||
/** | ||
* Close.io Api Wrapper - LLS Internet GmbH - Loopline Systems | ||
* | ||
* @link https://github.com/loopline-systems/closeio-api-wrapper for the canonical source repository | ||
* @copyright Copyright (c) 2014 LLS Internet GmbH - Loopline Systems (http://www.loopline-systems.com) | ||
* @license https://github.com/loopline-systems/closeio-api-wrapper/blob/master/LICENSE (MIT Licence) | ||
*/ | ||
|
||
namespace LooplineSystems\CloseIoApiWrapper\Tests; | ||
|
||
use LooplineSystems\CloseIoApiWrapper\Library\Exception\JsonDecodingException; | ||
|
||
class ExceptionsTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @param $data | ||
* @throws JsonDecodingException | ||
* @dataProvider badJsonProvider | ||
*/ | ||
public function testJsonDecodeException($data, $expectedMessage) | ||
{ | ||
$this->setExpectedException('LooplineSystems\CloseIoApiWrapper\Library\Exception\JsonDecodingException'); | ||
json_decode($data); | ||
if (json_last_error() !== JSON_ERROR_NONE) { | ||
$exception = new JsonDecodingException(json_last_error()); | ||
$this->assertTrue($exception->getMessage() === $expectedMessage); | ||
throw $exception; | ||
} | ||
} | ||
|
||
/** | ||
* @param $data | ||
* @throws JsonDecodingException | ||
* @dataProvider badDataProvider | ||
*/ | ||
public function testJsonEncodeException($data, $expectedMessage) | ||
{ | ||
$this->setExpectedException('LooplineSystems\CloseIoApiWrapper\Library\Exception\JsonDecodingException'); | ||
json_encode($data); | ||
if (json_last_error() !== JSON_ERROR_NONE) { | ||
$exception = new JsonDecodingException(json_last_error()); | ||
$this->assertTrue($exception->getMessage() === $expectedMessage); | ||
throw $exception; | ||
} | ||
} | ||
|
||
|
||
public function badJsonProvider() | ||
{ | ||
return [ | ||
[ | ||
"{'Organization': 'PHP Documentation Team'}", | ||
JsonDecodingException::JSON_ERROR_SYNTAX_MESSAGE | ||
], | ||
[ | ||
'{ bar: "baz" }', | ||
JsonDecodingException::JSON_ERROR_SYNTAX_MESSAGE | ||
], | ||
[ | ||
"{ 'bar': 'baz' }", | ||
JsonDecodingException::JSON_ERROR_SYNTAX_MESSAGE | ||
], | ||
[ | ||
'{ bar: "baz", }', | ||
JsonDecodingException::JSON_ERROR_SYNTAX_MESSAGE | ||
] | ||
]; | ||
} | ||
|
||
public function badDataProvider() | ||
{ | ||
return [ | ||
[ | ||
"\xB1\x31", | ||
JsonDecodingException::JSON_ERROR_UTF8_MESSAGE | ||
], | ||
]; | ||
} | ||
} |
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