FOSElasticaBundle/Tests/DependencyInjection/FOSElasticaExtensionTest.php
Christophe Coevoet 5060fa4d4a Move the test file to a better location
The test of the DI extension is not a functional test.
2015-01-21 17:51:56 +01:00

33 lines
1.1 KiB
PHP

<?php
namespace FOS\ElasticaBundle\Tests\DependencyInjection;
use FOS\ElasticaBundle\DependencyInjection\FOSElasticaExtension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Yaml\Yaml;
class FOSElasticaExtensionTest extends \PHPUnit_Framework_TestCase
{
public function testShouldAddParentParamToObjectPersisterCall()
{
$config = Yaml::parse(file_get_contents(__DIR__.'/fixtures/config.yml'));
$containerBuilder = new ContainerBuilder;
$containerBuilder->setParameter('kernel.debug', true);
$extension = new FOSElasticaExtension;
$extension->load($config, $containerBuilder);
$this->assertTrue($containerBuilder->hasDefinition('fos_elastica.object_persister.test_index.child_field'));
$persisterCallDefinition = $containerBuilder->getDefinition('fos_elastica.object_persister.test_index.child_field');
$arguments = $persisterCallDefinition->getArguments();
$arguments = $arguments['index_3'];
$this->assertArrayHasKey('_parent', $arguments);
$this->assertEquals('parent_field', $arguments['_parent']['type']);
}
}