| Total Complexity | 5 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | class RegExpTest extends TestCase |
||
| 15 | { |
||
| 16 | public function testInterface() |
||
| 17 | { |
||
| 18 | $regexp = RegExp::of('/foo/'); |
||
| 19 | |||
| 20 | $this->assertSame('/foo/', $regexp->toString()); |
||
| 21 | } |
||
| 22 | |||
| 23 | public function testOf() |
||
| 24 | { |
||
| 25 | $regexp = RegExp::of('/foo/'); |
||
| 26 | |||
| 27 | $this->assertInstanceOf(RegExp::class, $regexp); |
||
| 28 | $this->assertSame('/foo/', $regexp->toString()); |
||
| 29 | } |
||
| 30 | |||
| 31 | public function testThrowWhenInvalidRegexp() |
||
| 32 | { |
||
| 33 | $this->expectException(DomainException::class); |
||
| 34 | |||
| 35 | RegExp::of('/foo'); |
||
| 36 | } |
||
| 37 | |||
| 38 | public function testMatches() |
||
| 39 | { |
||
| 40 | $regexp = RegExp::of('/^foo/'); |
||
| 41 | |||
| 42 | $this->assertTrue($regexp->matches(Str::of('foofoo'))); |
||
| 43 | $this->assertFalse($regexp->matches(Str::of('barfoo'))); |
||
| 44 | } |
||
| 45 | |||
| 46 | public function testCapture() |
||
| 56 | } |
||
| 57 | } |
||
| 58 |