1 | <?php |
||
16 | class ElasticsearchDataProviderExtensionTest extends \PHPUnit_Framework_TestCase |
||
17 | { |
||
18 | private $extension; |
||
19 | |||
20 | private $container; |
||
21 | |||
22 | protected function setUp() |
||
23 | { |
||
24 | $this->extension = new ElasticsearchDataProviderExtension(); |
||
25 | |||
26 | $this->container = new ContainerBuilder(); |
||
27 | $this->container->registerExtension($this->extension); |
||
28 | |||
29 | $this->container->set( |
||
30 | 'event_dispatcher', |
||
31 | $this->getMock(EventDispatcherInterface::class) |
||
32 | ); |
||
33 | |||
34 | $this->container->loadFromExtension($this->extension->getAlias()); |
||
35 | $this->container->compile(); |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * @dataProvider getServices |
||
40 | */ |
||
41 | public function testServices($serviceId, $classname) |
||
42 | { |
||
43 | $this->assertTrue( |
||
44 | $this->container->has($serviceId) |
||
45 | ); |
||
46 | |||
47 | $service = $this->container->get($serviceId); |
||
48 | |||
49 | $this->assertInstanceOf($classname, $service); |
||
50 | } |
||
51 | |||
52 | public function getServices() |
||
53 | { |
||
54 | return [ |
||
55 | [ |
||
56 | 'gbprod.elasticsearch_dataprovider.registry', |
||
57 | Registry::class, |
||
58 | ], |
||
59 | [ |
||
60 | 'gbprod.elasticsearch_dataprovider.handler', |
||
61 | Handler::class, |
||
62 | ], |
||
63 | ]; |
||
64 | } |
||
65 | } |
||
66 |