1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Tests\GBProd\ElasticaSpecificationBundle\DependencyInjection; |
4
|
|
|
|
5
|
|
|
use Elastica\QueryBuilder; |
6
|
|
|
use GBProd\ElasticaSpecificationBundle\DependencyInjection\ElasticaSpecificationExtension; |
7
|
|
|
use GBProd\ElasticaSpecification\Handler; |
8
|
|
|
use GBProd\ElasticaSpecification\Registry; |
9
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Tests for ElasticaSpecificationExtension |
13
|
|
|
* |
14
|
|
|
* @author gbprod <[email protected]> |
15
|
|
|
*/ |
16
|
|
|
class ElasticaSpecificationExtensionTest extends \PHPUnit_Framework_TestCase |
17
|
|
|
{ |
18
|
|
|
private $extension; |
19
|
|
|
private $container; |
20
|
|
|
|
21
|
|
|
protected function setUp() |
22
|
|
|
{ |
23
|
|
|
$this->extension = new ElasticaSpecificationExtension(); |
24
|
|
|
|
25
|
|
|
$this->container = new ContainerBuilder(); |
26
|
|
|
$this->container->registerExtension($this->extension); |
27
|
|
|
|
28
|
|
|
$this->container->loadFromExtension($this->extension->getAlias()); |
29
|
|
|
$this->container->compile(); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function testLoadHasServices() |
33
|
|
|
{ |
34
|
|
|
$this->assertTrue( |
35
|
|
|
$this->container->has('gbprod.elastica_specification_querybuilder') |
36
|
|
|
); |
37
|
|
|
|
38
|
|
|
$this->assertTrue( |
39
|
|
|
$this->container->has('gbprod.elastica_specification_registry') |
40
|
|
|
); |
41
|
|
|
|
42
|
|
|
$this->assertTrue( |
43
|
|
|
$this->container->has('gbprod.elastica_specification_handler') |
44
|
|
|
); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
public function testLoadQueryBuilder() |
48
|
|
|
{ |
49
|
|
|
$registry = $this->container->get('gbprod.elastica_specification_querybuilder'); |
50
|
|
|
|
51
|
|
|
$this->assertInstanceOf(QueryBuilder::class, $registry); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
public function testLoadRegistry() |
55
|
|
|
{ |
56
|
|
|
$registry = $this->container->get('gbprod.elastica_specification_registry'); |
57
|
|
|
|
58
|
|
|
$this->assertInstanceOf(Registry::class, $registry); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function testLoadHandler() |
62
|
|
|
{ |
63
|
|
|
$handler = $this->container->get('gbprod.elastica_specification_handler'); |
64
|
|
|
|
65
|
|
|
$this->assertInstanceOf(Handler::class, $handler); |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|