DecodingErrorTest.php 659 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. declare(strict_types=1);
  3. namespace JsonMachineTest\JsonDecoder;
  4. use JsonMachine\JsonDecoder\DecodingError;
  5. use PHPUnit\Framework\TestCase;
  6. /**
  7. * @covers \JsonMachine\JsonDecoder\DecodingError
  8. */
  9. class DecodingErrorTest extends TestCase
  10. {
  11. public function testGetMalformedJson()
  12. {
  13. $decodingError = new DecodingError('"json\"', '');
  14. $this->assertSame('"json\"', $decodingError->getMalformedJson());
  15. }
  16. public function testGetErrorMessage()
  17. {
  18. $decodingError = new DecodingError('', 'something bad happened');
  19. $this->assertSame('something bad happened', $decodingError->getErrorMessage());
  20. }
  21. }