Total Complexity | 4 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
8 | class ServicesTest extends \PHPUnit_Framework_TestCase |
||
9 | { |
||
10 | /** |
||
11 | * @test |
||
12 | * |
||
13 | * @expectedException \InvalidArgumentException |
||
14 | */ |
||
15 | public function it_throws_exception_on_missing_service() |
||
16 | { |
||
17 | $services = new Services([], new CallableServiceLocator(function ($id) {})); |
||
|
|||
18 | $services->get('twig'); |
||
19 | } |
||
20 | |||
21 | /** |
||
22 | * @test |
||
23 | */ |
||
24 | public function it_proxies_mapped_service_id() |
||
25 | { |
||
26 | $locator = $this->getMock('Devmachine\Bundle\ServicesInjectorBundle\ServiceLocator\ServiceLocator'); |
||
27 | $locator |
||
28 | ->expects($this->once()) |
||
29 | ->method('get') |
||
30 | ->with($this->equalTo('router')) |
||
31 | ; |
||
32 | |||
33 | (new Services(['url_generator' => 'router'], $locator))->get('url_generator'); |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @test |
||
38 | * |
||
39 | * @expectedException \InvalidArgumentException |
||
40 | * @expectedExceptionMessage Service with alias "foo" is not registered. |
||
41 | */ |
||
42 | public function it_throws_exception_on_aliased_method_call_with_invalid_service() |
||
43 | { |
||
44 | $services = new Services([], new CallableServiceLocator(function ($id) {})); |
||
45 | $services->getFoo(); |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * @test |
||
50 | */ |
||
51 | public function it_maps_method_call_service_retrieval() |
||
61 | } |
||
62 | } |
||
63 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.