<commit_before><?php

/*
 * This file is part of the Symfony package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Reference;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ConfigCachePass;

class ConfigCachePassTest extends \PHPUnit_Framework_TestCase
{
    public function testThatCheckersAreProcessedInPriorityOrder()
    {
        $services = array(
            'checker_2' => array(0 => array('priority' => 100)),
            'checker_1' => array(0 => array('priority' => 200)),
            'checker_3' => array(),
        );

        $definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
        $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->getMock()->setMethods(array('findTaggedServiceIds', 'getDefinition', 'hasDefinition'))->getMock();

        $container->expects($this->atLeastOnce())
            ->method('findTaggedServiceIds')
            ->will($this->returnValue($services));
        $container->expects($this->atLeastOnce())
            ->method('getDefinition')
            ->with('config_cache_factory')
            ->will($this->returnValue($definition));

        $definition->expects($this->once())
            ->method('replaceArgument')
            ->with(0, array(
                    new Reference('checker_1'),
                    new Reference('checker_2'),
                    new Reference('checker_3'),
                ));

        $pass = new ConfigCachePass();
        $pass->process($container);
    }

    public function testThatCheckersCanBeMissing()
    {
        $definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
        $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->getMock()->setMethods(array('findTaggedServiceIds'))->getMock();

        $container->expects($this->atLeastOnce())
            ->method('findTaggedServiceIds')
            ->will($this->returnValue(array()));

        $pass = new ConfigCachePass();
        $pass->process($container);<commit_msg>fixed tests<commit_after><?php

/*
 * This file is part of the Symfony package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Reference;
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ConfigCachePass;

class ConfigCachePassTest extends \PHPUnit_Framework_TestCase
{
    public function testThatCheckersAreProcessedInPriorityOrder()
    {
        $services = array(
            'checker_2' => array(0 => array('priority' => 100)),
            'checker_1' => array(0 => array('priority' => 200)),
            'checker_3' => array(),
        );

        $definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
        $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('findTaggedServiceIds', 'getDefinition', 'hasDefinition'))->getMock();

        $container->expects($this->atLeastOnce())
            ->method('findTaggedServiceIds')
            ->will($this->returnValue($services));
        $container->expects($this->atLeastOnce())
            ->method('getDefinition')
            ->with('config_cache_factory')
            ->will($this->returnValue($definition));

        $definition->expects($this->once())
            ->method('replaceArgument')
            ->with(0, array(
                    new Reference('checker_1'),
                    new Reference('checker_2'),
                    new Reference('checker_3'),
                ));

        $pass = new ConfigCachePass();
        $pass->process($container);
    }

    public function testThatCheckersCanBeMissing()
    {
        $definition = $this->getMockBuilder('Symfony\Component\DependencyInjection\Definition')->getMock();
        $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')->setMethods(array('findTaggedServiceIds'))->getMock();

        $container->expects($this->atLeastOnce())
            ->method('findTaggedServiceIds')
            ->will($this->returnValue(array()));

        $pass = new ConfigCachePass();
        $pass->process($container);
{'fraction_non_alphanumeric': 0.14450619923044036, 'fraction_numerical': 0.006412997007268063, 'mean_word_length': 3.192652329749104, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 89, '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': '2765990', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1197, 'n_words': 194}