| Conditions | 1 |
| Paths | 1 |
| Total Lines | 12 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 1 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | 1 | public function testGetRoles() |
|
| 12 | { |
||
| 13 | 1 | $secured_routes = ['route_foo', 'route_bar']; |
|
| 14 | 1 | $routeToRoleConverter = $this->createMock(RouteToRoleConverter::class); |
|
| 15 | $routeToRoleConverter |
||
| 16 | 1 | ->expects(new \PHPUnit_Framework_MockObject_Matcher_InvokedCount(count($secured_routes))) |
|
| 17 | 1 | ->method('generateRoleForRoute') |
|
| 18 | 1 | ->will($this->returnCallback(function ($route) { |
|
| 19 | 1 | return 'ROLE_'.strtoupper($route); |
|
| 20 | 1 | })); |
|
| 21 | 1 | $rolesProvider = new RolesProvider($routeToRoleConverter, $secured_routes); |
|
| 22 | 1 | $this->assertEquals(['ROLE_ROUTE_FOO', 'ROLE_ROUTE_BAR'], $rolesProvider->getRoles()); |
|
| 23 | 1 | } |
|
| 25 |