<commit_before><?php

/**
 * This file is part of the contentful/contentful-bundle package.
 *
 * @copyright 2015-2020 Contentful GmbH
 * @license   MIT
 */

declare(strict_types=1);

namespace Contentful\Tests\ContentfulBundle\ContentfulBundle\Unit\Compiler;

use Contentful\ContentfulBundle\DependencyInjection\Compiler\ProfilerControllerPass;
use Contentful\Tests\ContentfulBundle\TestCase;
use Symfony\Component\DependencyInjection\Definition;

class ProfilerControllerPassTest extends TestCase
{
    public function testMissingProfilerAndTwig()
    {
        $container = $this->getContainer();

        $compilerPass = new ProfilerControllerPass();
        $container->addCompilerPass($compilerPass);
        $compilerPass->process($container);

        $this->assertFalse($container->hasDefinition('contentful.delivery.profiler_controller'));
    }

    public function testMissingProfiler()
    {
        $container = $this->getContainer();
        $container->setDefinition('twig', new Definition());

        $compilerPass = new ProfilerControllerPass();
        $container->addCompilerPass($compilerPass);
        $compilerPass->process($container);

        $this->assertFalse($container->hasDefinition('contentful.delivery.profiler_controller'));
    }

    public function testMissingTwig()
    {
        $container = $this->getContainer();
        $container->setDefinition('profiler', new Definition());

        $compilerPass = new ProfilerControllerPass();
        $container->addCompilerPass($compilerPass);
        $compilerPass->process($container);

        $this->assertFalse($container->hasDefinition('contentful.delivery.profiler_controller'));
    }

    public function testProfilerAndTwigPresent()
    {
        $container = $this->getContainer();
        $container->setDefinition('profiler', new Definition());
        $container->setDefinition('twig', new Definition());
        $compilerPass = new ProfilerControllerPass();

        $container->addCompilerPass($compilerPass);
        $compilerPass->process($container);

        $this->assertTrue($container->hasDefinition('contentful.delivery.profiler_controller'));
    }
}<commit_msg>Fixed unit test to work with the latest changes for the name of data collector<commit_after><?php

/**
 * This file is part of the contentful/contentful-bundle package.
 *
 * @copyright 2015-2020 Contentful GmbH
 * @license   MIT
 */

declare(strict_types=1);

namespace Contentful\Tests\ContentfulBundle\ContentfulBundle\Unit\Compiler;

use Contentful\ContentfulBundle\DependencyInjection\Compiler\ProfilerControllerPass;
use Contentful\Tests\ContentfulBundle\TestCase;
use Symfony\Component\DependencyInjection\Definition;

class ProfilerControllerPassTest extends TestCase
{
    public function testMissingProfilerAndTwig()
    {
        $container = $this->getContainer();

        $compilerPass = new ProfilerControllerPass();
        $container->addCompilerPass($compilerPass);
        $compilerPass->process($container);

        $this->assertFalse($container->hasDefinition('contentful.profiler_controller'));
    }

    public function testMissingProfiler()
    {
        $container = $this->getContainer();
        $container->setDefinition('twig', new Definition());

        $compilerPass = new ProfilerControllerPass();
        $container->addCompilerPass($compilerPass);
        $compilerPass->process($container);

        $this->assertFalse($container->hasDefinition('contentful.profiler_controller'));
    }

    public function testMissingTwig()
    {
        $container = $this->getContainer();
        $container->setDefinition('profiler', new Definition());

        $compilerPass = new ProfilerControllerPass();
        $container->addCompilerPass($compilerPass);
        $compilerPass->process($container);

        $this->assertFalse($container->hasDefinition('contentful.profiler_controller'));
    }

    public function testProfilerAndTwigPresent()
    {
        $container = $this->getContainer();
        $container->setDefinition('profiler', new Definition());
        $container->setDefinition('twig', new Definition());
        $compilerPass = new ProfilerControllerPass();

        $container->addCompilerPass($compilerPass);
        $compilerPass->process($container);

        $this->assertTrue($container->hasDefinition('contentful.profiler_controller'));
    }
}
{'fraction_non_alphanumeric': 0.12405584802014191, 'fraction_numerical': 0.004119935912108034, 'mean_word_length': 4.099183197199533, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 51, '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': '2371586', 'n_tokens_mistral': 1122, 'n_tokens_neox': 1111, 'n_words': 182}