<commit_before><?php

namespace Oro\Component\Testing\Unit;

use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\SplFileInfo;
use Symfony\Component\Yaml\Yaml;

/**
 * This trait add support of loading YAML test cases in dataproviders
 */
trait LoadTestCaseDataTrait
{
    /**
     * @param string $path
     * @param string $fileNamePattern
     * @return array
     */
    protected function getTestCaseData($path, $fileNamePattern = '*.yml')
    {
        $finder = new Finder();

        $finder
            ->files()
            ->in($path)
            ->name($fileNamePattern);

        $cases = [];

        /** @var SplFileInfo $file */
        foreach ($finder as $file) {
            $cases[$file->getRelativePathname()] = Yaml::parse($file->getContents());
        }

        return $cases;
    }
}<commit_msg>BB-7434: Test overlay of menu updates (#9598)<commit_after><?php

namespace Oro\Component\Testing\Unit;

use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\SplFileInfo;
use Symfony\Component\Yaml\Yaml;

/**
 * This trait add support of loading YAML test cases in dataproviders
 */
trait LoadTestCaseDataTrait
{
    /**
     * @param string $path
     * @param string $fileNamePattern
     * @return array
     */
    protected function getTestCaseData($path, $fileNamePattern = '*.yml')
    {
        $finder = new Finder();

        $finder
            ->files()
            ->in($path)
            ->name($fileNamePattern);

        $cases = [];

        /** @var SplFileInfo $file */
        foreach ($finder as $file) {
            yield $file->getRelativePathname() => Yaml::parse($file->getContents());
        }

        return $cases;
    }
}
{'fraction_non_alphanumeric': 0.13596233078281342, 'fraction_numerical': 0.004708652148322542, 'mean_word_length': 2.3797216699801194, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, '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': '6015710', 'n_tokens_mistral': 509, 'n_tokens_neox': 501, 'n_words': 115}