Test mappings key being null still causes appropriate configuration changes

This commit is contained in:
Tim Nagel 2014-08-07 09:25:09 +10:00
parent f6e018f011
commit c44f676224
3 changed files with 5 additions and 3 deletions

View file

@ -182,7 +182,7 @@ class Configuration implements ConfigurationInterface
->treatNullLike(array())
// BC - Renaming 'mappings' node to 'properties'
->beforeNormalization()
->ifTrue(function($v) { return isset($v['mappings']); })
->ifTrue(function($v) { return array_key_exists('mappings', $v); })
->then(function($v) {
$v['properties'] = $v['mappings'];
unset($v['mappings']);
@ -213,7 +213,7 @@ class Configuration implements ConfigurationInterface
foreach ($v['dynamic_templates'] as $key => $type) {
if (is_int($key)) {
$dt[] = $type;
} else {
} else {
$dt[][$key] = $type;
}
}

View file

@ -26,7 +26,7 @@ class ConfigurationManagerTest extends WebTestCase
$index = $manager->getIndexConfiguration('index');
$this->assertEquals('index', $index->getName());
$this->assertCount(2, $index->getTypes());
$this->assertGreaterThanOrEqual(2, count($index->getTypes()));
$this->assertInstanceOf('FOS\\ElasticaBundle\\Configuration\\TypeConfig', $index->getType('type'));
$this->assertInstanceOf('FOS\\ElasticaBundle\\Configuration\\TypeConfig', $index->getType('parent'));
}

View file

@ -83,3 +83,5 @@ fos_elastica:
type: "parent"
property: "parent"
identifier: "id"
null_mappings:
mappings: ~