Issue: Parent is missing in the fields list that causes RoutingMissingException on flushing - test
This commit is contained in:
parent
714502fa1f
commit
1ef55b1239
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
namespace FOS\ElasticaBundle\Tests\Functional\DependencyInjection;
|
||||||
|
|
||||||
|
|
||||||
|
use FOS\ElasticaBundle\DependencyInjection\FOSElasticaExtension;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
|
use Symfony\Component\Yaml\Yaml;
|
||||||
|
|
||||||
|
class FOSElasticaExtensionTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function shouldAddParentParamToObjectPersisterCall()
|
||||||
|
{
|
||||||
|
|
||||||
|
$config = Yaml::parse(file_get_contents(__DIR__.'/config/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');
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('_parent', $persisterCallDefinition->getArguments()['index_3']);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
21
Tests/Functional/DependencyInjection/config/config.yml
Normal file
21
Tests/Functional/DependencyInjection/config/config.yml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
fos_elastica:
|
||||||
|
clients:
|
||||||
|
default:
|
||||||
|
url: http://localhost:9200
|
||||||
|
indexes:
|
||||||
|
test_index:
|
||||||
|
client: default
|
||||||
|
types:
|
||||||
|
parent_field:
|
||||||
|
mappings:
|
||||||
|
text: ~
|
||||||
|
persistence:
|
||||||
|
driver: orm
|
||||||
|
model: foo_model
|
||||||
|
child_field:
|
||||||
|
mappings:
|
||||||
|
text: ~
|
||||||
|
persistence:
|
||||||
|
driver: orm
|
||||||
|
model: foo_model
|
||||||
|
_parent: { type: "parent_field", property: "parent" }
|
Loading…
Reference in a new issue