| Conditions | 2 |
| Paths | 2 |
| Total Lines | 23 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | public function test() |
||
| 11 | { |
||
| 12 | $defaultUrlGenerator = $this->mockUrlGenerator(); |
||
| 13 | $registry = new UrlGeneratorRegistry($defaultUrlGenerator); |
||
| 14 | |||
| 15 | $this->assertSame($defaultUrlGenerator, $registry->get(UrlGeneratorRegistry::DEFAULT_URL_GENERATOR_KEY)); |
||
| 16 | $this->assertSame($defaultUrlGenerator, $registry->get()); |
||
| 17 | |||
| 18 | $exception = null; |
||
| 19 | try { |
||
| 20 | $registry->get('foo'); |
||
| 21 | } catch (\Exception $e) { |
||
| 22 | $exception = $e; |
||
| 23 | } |
||
| 24 | $this->assertInstanceOf('InvalidArgumentException', $exception); |
||
| 25 | $this->assertSame( |
||
| 26 | 'The "foo" url generator is not set. Available url generators are: default.', |
||
| 27 | $exception->getMessage() |
||
| 28 | ); |
||
| 29 | |||
| 30 | $registry->set('foo', $fooUrlGenerator = $this->mockUrlGenerator()); |
||
| 31 | $this->assertSame($fooUrlGenerator, $registry->get('foo')); |
||
| 32 | } |
||
| 33 | |||
| 39 |