| Total Complexity | 6 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | final class PathPatternGeneratorTest extends TestCase |
||
| 11 | { |
||
| 12 | public function test_empty_path_returns_root_pattern(): void |
||
| 13 | { |
||
| 14 | $pattern = PathPatternGenerator::generate(''); |
||
| 15 | |||
| 16 | self::assertSame('#^/?$#', $pattern); |
||
| 17 | } |
||
| 18 | |||
| 19 | public function test_simple_static_path(): void |
||
| 20 | { |
||
| 21 | $pattern = PathPatternGenerator::generate('users'); |
||
| 22 | |||
| 23 | self::assertSame('#^/users$#', $pattern); |
||
| 24 | } |
||
| 25 | |||
| 26 | public function test_single_mandatory_parameter(): void |
||
| 27 | { |
||
| 28 | $pattern = PathPatternGenerator::generate('users/{id}'); |
||
| 29 | |||
| 30 | self::assertSame('#^/users/([^\/]+)$#', $pattern); |
||
| 31 | } |
||
| 32 | |||
| 33 | public function test_single_optional_parameter(): void |
||
| 34 | { |
||
| 35 | $pattern = PathPatternGenerator::generate('users/{id?}'); |
||
| 36 | |||
| 37 | self::assertSame('#^/users/?([^\/]+)?$#', $pattern); |
||
| 38 | } |
||
| 39 | |||
| 40 | public function test_multiple_mandatory_parameters(): void |
||
| 45 | } |
||
| 46 | |||
| 47 | public function test_mixed_mandatory_and_optional_parameters(): void |
||
| 52 | } |
||
| 53 | } |
||
| 54 |