| Total Complexity | 5 |
| Total Lines | 62 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class SlugTest extends TestCase |
||
| 9 | { |
||
| 10 | public function testGivenAValidSlugAValidVOIsReturned(): void |
||
| 21 | } |
||
| 22 | |||
| 23 | public function badSlugDataProvider(): array |
||
| 31 | ]; |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @dataProvider badSlugDataProvider |
||
| 36 | * @param string $slug |
||
| 37 | */ |
||
| 38 | public function testGivenAnInvalidSlugAnExceptionIsThrown(string $slug): void |
||
| 39 | { |
||
| 40 | $this->expectException(\InvalidArgumentException::class); |
||
| 41 | $this->expectExceptionMessage("$slug is not a valid slug. Only lowercase, letters, numbers and dashes are allowed."); |
||
| 42 | |||
| 43 | Slug::fromValue($slug); |
||
| 44 | } |
||
| 45 | |||
| 46 | public function testGivenTwoEqualSlugsEqualReturnsTrue(): void |
||
| 47 | { |
||
| 48 | // Arrange |
||
| 49 | $slug1 = Slug::fromValue("this-is-a-valid-slug"); |
||
| 50 | $slug2 = Slug::fromValue("this-is-a-valid-slug"); |
||
| 51 | |||
| 52 | // Act |
||
| 53 | $equal = $slug1->equal($slug2); |
||
| 54 | |||
| 55 | // Assert |
||
| 56 | $this->assertTrue($equal); |
||
| 57 | } |
||
| 58 | |||
| 59 | public function testGivenTwoNotEqualSlugsEqualReturnsFalse(): void |
||
| 70 | } |
||
| 71 | } |
||
| 72 |