<commit_before><?php

namespace FOS\ElasticaBundle\Tests\Resetter\DependencyInjection;

use FOS\ElasticaBundle\DependencyInjection\Configuration;

/**
 * ConfigurationTest
 */
class ConfigurationTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var Configuration
     */
    private $configuration;

    public function setUp()
    {
        $this->configuration = new Configuration(array());
    }

    public function testEmptyConfigContainsFormatMappingOptionNode()
    {
        $tree = $this->configuration->getConfigTree();
        $children = $tree->getChildren();
        $children = $children['indexes']->getPrototype()->getChildren();
        $typeNodes = $children['types']->getPrototype()->getChildren();
        $mappings = $typeNodes['mappings']->getPrototype()->getChildren();

        $this->assertArrayHasKey('format', $mappings);
        $this->assertInstanceOf('Symfony\Component\Config\Definition\ScalarNode', $mappings['format']);
        $this->assertNull($mappings['format']->getDefaultValue());
    }

    public function testDynamicTemplateNodes()
    {
        $tree = $this->configuration->getConfigTree();
        $children = $tree->getChildren();
        $children = $children['indexes']->getPrototype()->getChildren();
        $typeNodes = $children['types']->getPrototype()->getChildren();
        $dynamicTemplates = $typeNodes['dynamic_templates']->getPrototype()->getChildren();

        $this->assertArrayHasKey('match', $dynamicTemplates);
        $this->assertInstanceOf('Symfony\Component\Config\Definition\ScalarNode', $dynamicTemplates['match']);
        $this->assertNull($dynamicTemplates['match']->getDefaultValue());

        $this->assertArrayHasKey('match_mapping_type', $dynamicTemplates);
        $this->assertInstanceOf('Symfony\Component\Config\Definition\ScalarNode', $dynamicTemplates['match_mapping_type']);
        $this->assertNull($dynamicTemplates['match_mapping_type']->getDefaultValue());

        $this->assertArrayHasKey('mapping', $dynamicTemplates);
        $this->assertInstanceOf('Symfony\Component\Config\Definition\ArrayNode', $dynamicTemplates['mapping']);
    }

    public function testDynamicTemplateMappingNodes()
    {
        $tree = $this->configuration->getConfigTree();
        $children = $tree->getChildren();
        $children = $children['indexes']->getPrototype()->getChildren();
        $typeNodes = $children['types']->getPrototype()->getChildren();
        $dynamicTemplates = $typeNodes['dynamic_templates']->getPrototype()->getChildren();
        $mapping = $dynamicTemplates['mapping']->getChildren();

        $this->assertArrayHasKey('type', $mapping);
        $this->assertInstanceOf('Symfony\Component\Config\Definition\ScalarNode', $mapping['type']);
        $this->assertNull($mapping['type']->getDefaultValue());

        $this->assertArrayHasKey('index', $mapping);
        $this->assertInstanceOf('Symfony\Component\Config\Definition\ScalarNode', $mapping['index']);
        $this->assertNull($mapping['index']->getDefaultValue());

        $this->assertArrayHasKey('fields', $mapping);
        $this->assertInstanceOf('Symfony\Component\Config\Definition\ArrayNode', $mapping['fields']);
    }
}
<commit_msg>Fixing tests<commit_after><?php

namespace FOS\ElasticaBundle\Tests\Resetter\DependencyInjection;

use FOS\ElasticaBundle\DependencyInjection\Configuration;

/**
 * ConfigurationTest
 */
class ConfigurationTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var Configuration
     */
    private $configuration;

    public function setUp()
    {
        $this->configuration = new Configuration(array());
    }

    public function testEmptyConfigContainsFormatMappingOptionNode()
    {
        $tree = $this->configuration->getConfigTree();
        $children = $tree->getChildren();
        $children = $children['indexes']->getPrototype()->getChildren();
        $typeNodes = $children['types']->getPrototype()->getChildren();
        $mappings = $typeNodes['mappings']->getPrototype()->getChildren();

        $this->assertArrayHasKey('format', $mappings);
        $this->assertInstanceOf('Symfony\Component\Config\Definition\ScalarNode', $mappings['format']);
        $this->assertNull($mappings['format']->getDefaultValue());
    }

    public function testDynamicTemplateNodes()
    {
        $tree = $this->configuration->getConfigTree();
        $children = $tree->getChildren();
        $children = $children['indexes']->getPrototype()->getChildren();
        $typeNodes = $children['types']->getPrototype()->getChildren();
        $dynamicTemplates = $typeNodes['dynamic_templates']->getPrototype()->getChildren();

        $this->assertArrayHasKey('match', $dynamicTemplates);
        $this->assertInstanceOf('Symfony\Component\Config\Definition\ScalarNode', $dynamicTemplates['match']);
        $this->assertNull($dynamicTemplates['match']->getDefaultValue());

        $this->assertArrayHasKey('match_mapping_type', $dynamicTemplates);
        $this->assertInstanceOf('Symfony\Component\Config\Definition\ScalarNode', $dynamicTemplates['match_mapping_type']);
        $this->assertNull($dynamicTemplates['match_mapping_type']->getDefaultValue());

        $this->assertArrayHasKey('mapping', $dynamicTemplates);
        $this->assertInstanceOf('Symfony\Component\Config\Definition\ArrayNode', $dynamicTemplates['mapping']);
    }

    public function testDynamicTemplateMappingNodes()
    {
        $tree = $this->configuration->getConfigTree();
        $children = $tree->getChildren();
        $children = $children['indexes']->getPrototype()->getChildren();
        $typeNodes = $children['types']->getPrototype()->getChildren();
        $dynamicTemplates = $typeNodes['dynamic_templates']->getPrototype()->getChildren();
        $mapping = $dynamicTemplates['mapping']->getChildren();

        $this->assertArrayHasKey('type', $mapping);
        $this->assertInstanceOf('Symfony\Component\Config\Definition\ScalarNode', $mapping['type']);
        $this->assertSame('string', $mapping['type']->getDefaultValue());

        $this->assertArrayHasKey('index', $mapping);
        $this->assertInstanceOf('Symfony\Component\Config\Definition\ScalarNode', $mapping['index']);
        $this->assertNull($mapping['index']->getDefaultValue());
    }
}

{'fraction_non_alphanumeric': 0.16730340655842088, 'fraction_numerical': 0.0, 'mean_word_length': 4.435121107266436, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 107, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6030300', 'n_tokens_mistral': 1638, 'n_tokens_neox': 1646, 'n_words': 186}