in example

$collection = new ArrayCollection($associatedContacts);
        $logEntry->setRecipients($collection);
    }

    protected function getKnownRecipients(array $recipients): array
    {
        $qb = $this->entityManager->getConnection()->createQueryBuilder();
        $tableName = $this->entityManager->getClassMetadata(Contact::class)->getTableName();

        $qb->select('*')
            ->from($tableName)
            ->add('where', $qb->expr()->in('mail_address', ':recipients'))
            ->setParameter('recipients', $recipients, Connection::PARAM_STR_ARRAY);

        return $qb->execute()->fetchAll(PDO::FETCH_ASSOC);
    }

    protected function persistContact(Contact $contact): void
    {
        $this->entityManager->persist($contact);
        $this->entityManager->flush();
    }

    
static::assertEquals($expectedDe$actualDe);
        static::assertEquals($expectedEn$actualEn);
    }

    /** * @return array<string> */
    private function getSnippetFilePathsOfFixtures(string $folder, string $namePattern): array
    {
        $finder = (new Finder())
            ->files()
            ->in(__DIR__ . '/fixtures/' . $folder . '/')
            ->ignoreUnreadableDirs()
            ->name($namePattern);

        $iterator = $finder->getIterator();

        $files = [];
        foreach ($iterator as $file) {
            $files[] = $file->getRealPath();
        }

        return $files;
    }
if ($snippetFile) {
                $snippetFiles[] = $snippetFile;
            }
        }

        return $snippetFiles;
    }

    private function getSnippetFinder(string $snippetDir): Finder
    {
        $finder = new Finder();
        $finder->in($snippetDir)
            ->files()
            ->name('*.json');

        return $finder;
    }

    /** * @param array<string> $nameParts */
    private function createSnippetFile(array $nameParts, SplFileInfo $fileInfo, string $author): ?GenericSnippetFile
    {
        
$files = @scandir($full_path)) && count($files) <= 2,
      'Directory is not empty: ' . implode(', ', $files)
    );

    $base->tearDown();
  }

  /** * @covers ::findAvailablePort */
  public function testPortMany() {
    $iterator = (new Finder())->in($this->getDrupalRoot())
      ->ignoreDotFiles(FALSE)
      ->exclude(['sites/simpletest'])
      ->path('/^.ht.router.php$/')
      ->getIterator();
    $this->copyCodebase($iterator);
    /** @var \Symfony\Component\Process\Process[] $processes */
    $processes = [];
    $count = 15;
    for ($i = 0; $i <= $count$i++) {
      $port = $this->findAvailablePort();
      $this->assertArrayNotHasKey($port$processes, 'Port ' . $port . ' was already in use by a process.');
      


        // Register translation resources         if ($dirs) {
            $files = [];

            foreach ($dirs as $dir) {
                $finder = Finder::create()
                    ->followLinks()
                    ->files()
                    ->filter(fn (\SplFileInfo $file) => 2 <= substr_count($file->getBasename(), '.') && preg_match('/\.\w+$/', $file->getBasename()))
                    ->in($dir)
                    ->sortByName()
                ;
                foreach ($finder as $file) {
                    $fileNameParts = explode('.', basename($file));
                    $locale = $fileNameParts[\count($fileNameParts) - 2];
                    if (!isset($files[$locale])) {
                        $files[$locale] = [];
                    }

                    $files[$locale][] = (string) $file;
                }
            }
return $this->isFile($file) && 'php' === pathinfo($file, \PATHINFO_EXTENSION);
    }

    protected function extractFromDirectory(string|array $directory): iterable
    {
        if (!class_exists(Finder::class)) {
            throw new \LogicException(sprintf('You cannot use "%s" as the "symfony/finder" package is not installed. Try running "composer require symfony/finder".', static::class));
        }

        $finder = new Finder();

        return $finder->files()->name('*.php')->in($directory);
    }
}
$spec = [
            'paths' => [],
            'components' => [],
            'tags' => [],
        ];

        if (empty($this->paths)) {
            return $spec;
        }

        $finder = new Finder();
        $finder->in($this->paths)->name('*.json');

        foreach ($finder as $entry) {
            try {
                $data = json_decode((string) file_get_contents($entry->getPathname()), true, 512, \JSON_THROW_ON_ERROR);
            } catch (\JsonException $exception) {
                throw ApiException::invalidSchemaDefinitions($entry->getPathname()$exception);
            }

            $spec['paths'] = \array_replace_recursive($spec['paths']$data['paths'] ?? []);
            $spec['components'] = array_merge_recursive(
                $spec['components'],
                

  protected function getComponentPathsFinder(string $drupal_root): Finder {
    $finder = new Finder();
    $finder->name('composer.json')
      ->in($drupal_root . static::$componentsPath)
      ->ignoreUnreadableDirs()
      ->depth(1);

    return $finder;
  }

}

    public function testAllTransliterator(string $locale)
    {
        $tr = EmojiTransliterator::create($locale);

        $this->assertNotEmpty($tr->transliterate('😀'));
    }

    public static function provideLocaleTest(): iterable
    {
        $file = (new Finder())
            ->in(__DIR__.'/../../Resources/data/transliterator/emoji')
            ->name('*.php')
            ->notName('emoji-strip.php')
            ->files()
        ;

        foreach ($file as $file) {
            yield [$file->getBasename('.php')];
        }
    }

    public function testTransliterateWithInvalidLocale()
    {

        }

        return $filesInfo;
    }

    protected function findFiles(string $filename): iterable
    {
        if (is_file($filename)) {
            return [$filename];
        } elseif (is_dir($filename)) {
            return Finder::create()->files()->in($filename)->name($this->namePatterns);
        }

        throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename));
    }

    private function validate(string $template, string $file): array
    {
        $realLoader = $this->twig->getLoader();
        try {
            $temporaryLoader = new ArrayLoader([$file => $template]);
            $this->twig->setLoader($temporaryLoader);
            

#[Package('system-settings')] class KeyMappingPipeTest extends TestCase
{
    public function testEmptyMapping(): void
    {
        $mapping = [];
        $keyMappingPipe = new KeyMappingPipe($mapping, true);

        $config = new Config($mapping[][]);
        $pipeInResult = $keyMappingPipe->in($config['foo' => 'bar']);
        static::assertInstanceOf(\Traversable::class$pipeInResult);
        $actualOutput = iterator_to_array($pipeInResult);
        static::assertEmpty($actualOutput);

        $pipeOutResult = $keyMappingPipe->out($config['foo' => 'bar']);
        static::assertInstanceOf(\Traversable::class$pipeOutResult);
        $actualOutput = iterator_to_array($pipeOutResult);
        static::assertEmpty($actualOutput);
    }

    /** * @return array<array{input: array<string, mixed>, expectedOutput: array<string, mixed>}> */
private function getRandomFile(DemodataContext $context): string
    {
        $fixtureDir = $context->getProjectDir() . '/build/media';
        $images = [];

        if (is_dir($fixtureDir)) {
            $images = array_values(
                iterator_to_array(
                    (new Finder())
                        ->files()
                        ->in($fixtureDir)
                        ->name('/\.(jpg|png)$/')
                        ->getIterator()
                )
            );
        }

        if (\count($images)) {
            return $images[array_rand($images)]->getPathname();
        }

        /** @var string $text */
        

    public function getScriptPathsForApp(string $appPath): array
    {
        $scriptDirectory = $this->appLoader->locatePath($appPath, self::SCRIPT_DIR);

        if ($scriptDirectory === null || !is_dir($scriptDirectory)) {
            return [];
        }

        $finder = new Finder();
        $finder->files()
            ->in($scriptDirectory)
            ->exclude('rule-conditions')
            ->name(self::ALLOWED_FILE_EXTENSIONS)
            ->ignoreUnreadableDirs();

        return array_values(array_map(static fn (\SplFileInfo $file): string => ltrim(mb_substr($file->getPathname()mb_strlen($scriptDirectory)), '/')iterator_to_array($finder)));
    }

    /** * Returns the content of the script */
    public function getScriptContent(string $name, string $appPath): string
    {
public function testCacheIsFreshAfterCacheClearedWithWarmup()
    {
        $input = new ArrayInput(['cache:clear']);
        $application = new Application($this->kernel);
        $application->setCatchExceptions(false);

        $application->doRun($inputnew NullOutput());

        // Ensure that all *.meta files are fresh         $finder = new Finder();
        $metaFiles = $finder->files()->in($this->kernel->getCacheDir())->name('*.php.meta');
        // check that cache is warmed up         $this->assertNotEmpty($metaFiles);
        $configCacheFactory = new ConfigCacheFactory(true);

        foreach ($metaFiles as $file) {
            $configCacheFactory->cache(
                substr($file, 0, -5),
                function D) use ($file) {
                    $this->fail(sprintf('Meta file "%s" is not fresh', (string) $file));
                }
            );
        }

        // create a temporary kernel         $kernel = $this->getApplication()->getKernel();
        if (!$kernel instanceof RebootableInterface) {
            throw new \LogicException('Calling "cache:clear" with a kernel that does not implement "Symfony\Component\HttpKernel\RebootableInterface" is not supported.');
        }
        $kernel->reboot($warmupDir);

        // fix references to cached files with the real cache directory name         $search = [$warmupDirstr_replace('\\', '\\\\', $warmupDir)];
        $replace = str_replace('\\', '/', $realBuildDir);
        foreach (Finder::create()->files()->in($warmupDir) as $file) {
            $content = str_replace($search$replacefile_get_contents($file)$count);
            if ($count) {
                file_put_contents($file$content);
            }
        }
    }

    private function warmupOptionals(string $cacheDir, string $warmupDir, SymfonyStyle $io): void
    {
        $kernel = $this->getApplication()->getKernel();
        $warmer = $kernel->getContainer()->get('cache_warmer');
        
Home | Imprint | This part of the site doesn't use cookies.