Repository: symfony/symfony
File: src/Symfony/Component/Yaml/Tests/YamlTestSuiteTest.php (PHP)

Code before:
        'Z67P',
        'ZH7C',
    ];

    #[DataProvider('yamlTestSuiteProvider')]
    public function testYamlTestSuite(string $testName, string $shortcode, string $file, bool $isError, mixed $expected)
    {
        if ('' === $file) {
            $this->markTestSkipped('The YAML test suite is not available: '.$testName);
        }

        if (\in_array($shortcode, self::SKIP, true)) {
            $this->markTestSkipped('Test case "'.$testName.'" ('.$shortcode.') is skipped.');
        }

        $isErrorExpected = false;
        if ($isError) {
            $isErrorExpected = true;
            $this->expectException(ParseException::class);
        }

        $data = Yaml::parseFile($file);

        if (!$isErrorExpected) {
            $this->assertEquals($expected, $data, 'Test case "'.$testName.'" ('.$shortcode.') failed.');
        }
    }

    public static function yamlTestSuiteProvider(): \Generator
    {
        $dataDir = self::getTestSuitePath();

        if (null === $dataDir) {
            yield 'yaml-test-suite-missing' => ['YAML Test Suite Missing', '', '', false, null];

            return;
        }

        $shortcodeDirs = glob($dataDir.'/*', \GLOB_ONLYDIR);

        if (!$shortcodeDirs) {
            yield 'yaml-test-suite-empty' => ['YAML Test Suite Empty', '', '', false, null];

            return;
        }

        foreach ($shortcodeDirs as $shortcodeDir) {
            $shortcode = basename($shortcodeDir);

            if (\in_array($shortcode, ['name', 'tags'], true)) {
                continue;

Review comment (suggestion):
`isErrorExpected` always has the same value as `isError`, right? It seems like it can be removed

Code after:
        'Z67P',
        'ZH7C',
    ];

    #[DataProvider('yamlTestSuiteProvider')]
    public function testYamlTestSuite(string $testName, string $shortcode, string $file, bool $isErrorExpected, mixed $expected)
    {
        if ('' === $file) {
            $this->markTestSkipped(\sprintf('The YAML test suite is not available: %s', $testName));
        }

        if (\in_array($shortcode, self::SKIP, true)) {
            $this->markTestSkipped(\sprintf('Test case "%s" (%s) is skipped.', $testName, $shortcode));
        }

        if ($isErrorExpected) {
            $this->expectException(ParseException::class);
        }

        $data = Yaml::parseFile($file);

        if (!$isErrorExpected) {
            $this->assertEquals($expected, $data, \sprintf('Test case "%s" (%s) failed.', $testName, $shortcode));
        }
    }

    public static function yamlTestSuiteProvider(): \Generator
    {
        $dataDir = self::getTestSuitePath();

        if (null === $dataDir) {
            yield 'yaml-test-suite-missing' => ['YAML Test Suite Missing', '', '', false, null];

            return;
        }

        $shortcodeDirs = glob($dataDir.'/*', \GLOB_ONLYDIR);

        if (!$shortcodeDirs) {
            yield 'yaml-test-suite-empty' => ['YAML Test Suite Empty', '', '', false, null];

            return;
        }

        foreach ($shortcodeDirs as $shortcodeDir) {
            $shortcode = basename($shortcodeDir);

            if (\in_array($shortcode, ['name', 'tags'], true)) {
                continue;
            }