for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace FOS\ElasticaBundle\Tests\Index;
use FOS\ElasticaBundle\Configuration\TypeConfig;
use FOS\ElasticaBundle\Index\MappingBuilder;
class MappingBuilderTest extends \PHPUnit_Framework_TestCase
{
/**
* @var MappingBuilder
*/
private $builder;
protected function setUp()
$this->builder = new MappingBuilder();
}
public function testMappingBuilderStoreProperty()
$typeConfig = new TypeConfig('typename', [
'properties' => [
'storeless' => [
'type' => 'string'
],
'stored' => [
'type' => 'string',
'store' => true
'unstored' => [
'store' => false
]
]);
$mapping = $this->builder->buildTypeMapping($typeConfig);
$this->assertArrayNotHasKey('store', $mapping['properties']['storeless']);
$this->assertArrayHasKey('store', $mapping['properties']['stored']);
$this->assertTrue($mapping['properties']['stored']['store']);
$this->assertArrayHasKey('store', $mapping['properties']['unstored']);
$this->assertFalse($mapping['properties']['unstored']['store']);