2017-03-17 17:21:32 +13:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This file is part of the JsonSchema package.
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace JsonSchema\Tests;
|
|
|
|
|
|
|
|
use JsonSchema\ConstraintError;
|
2017-11-11 22:30:59 -02:00
|
|
|
use PHPUnit\Framework\TestCase;
|
2017-03-17 17:21:32 +13:00
|
|
|
|
2017-11-11 22:30:59 -02:00
|
|
|
class ConstraintErrorTest extends TestCase
|
2017-03-17 17:21:32 +13:00
|
|
|
{
|
2024-08-30 15:09:12 +02:00
|
|
|
public function testGetValidMessage(): void
|
2017-03-17 17:21:32 +13:00
|
|
|
{
|
|
|
|
$e = ConstraintError::ALL_OF();
|
|
|
|
$this->assertEquals('Failed to match all schemas', $e->getMessage());
|
|
|
|
}
|
|
|
|
|
2024-08-30 15:09:12 +02:00
|
|
|
public function testGetInvalidMessage(): void
|
2017-03-17 17:21:32 +13:00
|
|
|
{
|
|
|
|
$e = ConstraintError::MISSING_ERROR();
|
|
|
|
|
2024-08-27 09:00:10 +02:00
|
|
|
$this->expectException('\JsonSchema\Exception\InvalidArgumentException');
|
|
|
|
$this->expectExceptionMessage('Missing error message for missingError');
|
|
|
|
|
2017-03-17 17:21:32 +13:00
|
|
|
$e->getMessage();
|
|
|
|
}
|
|
|
|
}
|