Skip to content

Commit 034829c

Browse files
committed
pattern tests
1 parent e849d49 commit 034829c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Swaggest\JsonSchema\Tests\PHPUnit\Misc;
4+
5+
use Swaggest\JsonSchema\Helper;
6+
use Swaggest\JsonSchema\InvalidValue;
7+
8+
class PreparePatternTest extends \PHPUnit_Framework_TestCase
9+
{
10+
public function testFailedToPreparePattern()
11+
{
12+
$this->setExpectedException(get_class(new InvalidValue()), 'Failed to prepare preg pattern');
13+
Helper::toPregPattern('/#+~%');
14+
}
15+
16+
public function testInvalidPattern()
17+
{
18+
$this->setExpectedException(get_class(new InvalidValue()), 'Regex pattern is invalid: ((');
19+
Helper::toPregPattern('((');
20+
}
21+
}

0 commit comments

Comments
 (0)