Conditions | 1 |
Paths | 1 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function validation() |
||
17 | { |
||
18 | /** @var RecursiveValidator $validator */ |
||
19 | $validator = self::$kernel->getContainer()->get('validator'); |
||
20 | |||
21 | $this->assertCount(0, $validator->validate(new DummyRedirect('/foo', '/bar'))); |
||
22 | |||
23 | $errors = $validator->validate(new DummyRedirect(null, null)); |
||
24 | $this->assertCount(2, $errors); |
||
25 | $this->assertSame('Please enter a source.', $errors[0]->getMessage()); |
||
26 | $this->assertSame('source', $errors[0]->getPropertyPath()); |
||
27 | $this->assertSame('Please enter a destination.', $errors[1]->getMessage()); |
||
28 | $this->assertSame('destination', $errors[1]->getPropertyPath()); |
||
29 | |||
30 | $errors = $validator->validate(new DummyRedirect('/301-redirect', '/foo')); |
||
31 | $this->assertCount(1, $errors); |
||
32 | $this->assertSame('The source is already used.', $errors[0]->getMessage()); |
||
33 | $this->assertSame('source', $errors[0]->getPropertyPath()); |
||
34 | } |
||
35 | } |
||
36 |