-
Notifications
You must be signed in to change notification settings - Fork 964
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fix/json-error-exception' into 7.7
- Loading branch information
Showing
3 changed files
with
37 additions
and
2 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 |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
* Class JsonErrorException | ||
* | ||
* @category Elasticsearch | ||
* @package Elasticsearch\Common\Exceptions\Curl | ||
* @package Elasticsearch\Common\Exceptions\Serializer | ||
* @author Bez Hermoso <[email protected]> | ||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache2 | ||
* @link http://elastic.co | ||
|
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
35 changes: 35 additions & 0 deletions
35
tests/Elasticsearch/Tests/Serializers/SmartSerializerTest.php
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,35 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace Elasticsearch\Tests\Serializers; | ||
|
||
use Elasticsearch\Common\Exceptions\Serializer\JsonErrorException; | ||
use Elasticsearch\Serializers\SmartSerializer; | ||
use Mockery as m; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Class SmartSerializerTest | ||
* | ||
* @package Elasticsearch\Tests\Serializers | ||
*/ | ||
class SmartSerializerTest extends TestCase | ||
{ | ||
public function setUp(): void | ||
{ | ||
$this->serializer = new SmartSerializer(); | ||
} | ||
|
||
/** | ||
* @requires PHP 7.3 | ||
* @see https://github.com/elastic/elasticsearch-php/issues/1012 | ||
*/ | ||
public function testThrowJsonErrorException() | ||
{ | ||
$this->expectException(JsonErrorException::class); | ||
$this->expectExceptionCode(JSON_ERROR_SYNTAX); | ||
|
||
$result = $this->serializer->deserialize('{ "foo" : bar" }', []); | ||
} | ||
} |