<commit_before><?php declare(strict_types=1);

namespace Symplify\EasyCodingStandard\Tests\Yaml\CheckerTolerantYamlFileLoader;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symplify\EasyCodingStandard\Yaml\CheckerTolerantYamlFileLoader;

final class ParametersMergeTest extends TestCase
{
    /**
     * @dataProvider provideConfigToParametersDefinition()
     * @param mixed[] $expectedSkip
     */
    public function testSkipParameters(string $configFile, array $expectedSkip): void
    {
        $containerBuilder = $this->createAndLoadContainerBuilderFromConfig($configFile);

        $skip = $containerBuilder->getParameterBag()->get('skip');

        $this->assertSame($expectedSkip, $skip);
    }

    /**
     * @return mixed[][]
     */
    public function provideConfigToParametersDefinition(): array
    {
        return [
            'configuration importing the parent with already defined skip parameters' => [
                __DIR__ . '/ParametersSource/config-skip-with-import.yml',
                [
                    'firstCode' => null,
                    'secondCode' => false,
                    'thirdCode' => null,
                ],
            ],
            'configuration importing empty import' => [
                __DIR__ . '/ParametersSource/config-skip-with-import-empty.yml',
                [
                    'firstCode' => null,
                    'secondCode' => null,
                ],
            ],
        ];
    }

    private function createAndLoadContainerBuilderFromConfig(string $config): ContainerBuilder
    {
        $containerBuilder = new ContainerBuilder();

        $yamlFileLoader = new CheckerTolerantYamlFileLoader($containerBuilder, new FileLocator(dirname($config)));
        $yamlFileLoader->load($config);

        return $containerBuilder;
    }
}<commit_msg>turn keys in provided sets to explicit message on test fail<commit_after><?php declare(strict_types=1);

namespace Symplify\EasyCodingStandard\Tests\Yaml\CheckerTolerantYamlFileLoader;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symplify\EasyCodingStandard\Yaml\CheckerTolerantYamlFileLoader;

final class ParametersMergeTest extends TestCase
{
    /**
     * @dataProvider provideConfigToParametersDefinition()
     * @param mixed[] $expectedSkip
     */
    public function testSkipParameters(string $configFile, array $expectedSkip, string $message): void
    {
        $containerBuilder = $this->createAndLoadContainerBuilderFromConfig($configFile);

        $skip = $containerBuilder->getParameterBag()->get('skip');

        $this->assertSame($expectedSkip, $skip, $message);
    }

    /**
     * @return mixed[][]
     */
    public function provideConfigToParametersDefinition(): array
    {
        return [
            [
                __DIR__ . '/ParametersSource/config-skip-with-import.yml',
                [
                    'firstCode' => null,
                    'secondCode' => false,
                    'thirdCode' => null,
                ],
                'configuration importing the parent with already defined skip parameters',
            ],
            [
                __DIR__ . '/ParametersSource/config-skip-with-import-empty.yml',
                [
                    'firstCode' => null,
                    'secondCode' => null,
                ],
                'configuration importing empty import',
            ],
        ];
    }

    private function createAndLoadContainerBuilderFromConfig(string $config): ContainerBuilder
    {
        $containerBuilder = new ContainerBuilder();

        $yamlFileLoader = new CheckerTolerantYamlFileLoader($containerBuilder, new FileLocator(dirname($config)));
        $yamlFileLoader->load($config);

        return $containerBuilder;
    }
}
{'fraction_non_alphanumeric': 0.10281083818688276, 'fraction_numerical': 0.0005064573309698658, 'mean_word_length': 2.4228769497400346, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, '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': '5664739', 'n_tokens_mistral': 1010, 'n_tokens_neox': 968, 'n_words': 183}