Conditions | 1 |
Paths | 1 |
Total Lines | 29 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
28 | public function testRealLifeExample(): void |
||
29 | { |
||
30 | // setup |
||
31 | $router = $this->getRouter(); |
||
32 | $router->addRoute('/user/[s:login]/custom-field/[s:name]', function () { |
||
33 | return 'get-custom-field'; |
||
34 | }); |
||
35 | $router->addRoute('/user/[s:login]/custom-field/[s:name]/add', function () { |
||
36 | return 'add-custom-field'; |
||
37 | }); |
||
38 | $router->addRoute('/user/[s:login]/custom-field/[s:name]/delete', function () { |
||
39 | return 'delete-custom-field'; |
||
40 | }); |
||
41 | $router->addRoute('/restore-password/[s:token]', function () { |
||
42 | return 'restore-password'; |
||
43 | }); |
||
44 | $router->addRoute('/reset-password/[s:token]', function () { |
||
45 | return 'reset-password'; |
||
46 | }); |
||
47 | $router->addRoute('/user/[s:login]/delete', function () { |
||
48 | return 'user-delete'; |
||
49 | }); |
||
50 | |||
51 | // test body |
||
52 | /** @var string $result */ |
||
53 | $result = $router->callRoute('/user/index@localhost/custom-field/name/add'); |
||
54 | |||
55 | // assertions |
||
56 | $this->assertEquals('add-custom-field', $result); |
||
57 | } |
||
59 |