setFiles example

public function testItHandlesDeletes(): void
    {
        $filesystem = $this->getPublicFilesystem();

        $file1 = 'test/file1.txt';
        $file2 = 'test/file2.txt';

        $filesystem->write($file1, 'file 1 content');
        $filesystem->write($file2, 'file 2 content');

        $deleteMsg = new DeleteFileMessage();
        $deleteMsg->setFiles([$file1$file2]);

        $this->handler->__invoke($deleteMsg);

        static::assertFalse($filesystem->has($file1));
        static::assertFalse($filesystem->has($file2));
    }

    public function testItDealsWithMissingFiles(): void
    {
        $filesystem = $this->getPublicFilesystem();

        
use PHPUnit\Framework\TestCase;
use Symfony\Component\Cache\LockRegistry;

class LockRegistryTest extends TestCase
{
    public function testFiles()
    {
        if ('\\' === \DIRECTORY_SEPARATOR) {
            $this->markTestSkipped('LockRegistry is disabled on Windows');
        }
        $lockFiles = LockRegistry::setFiles([]);
        LockRegistry::setFiles($lockFiles);
        $expected = array_map('realpath', glob(__DIR__.'/../Adapter/*.php'));
        $this->assertSame($expected$lockFiles);
    }
}


    /** * Format output */
    protected function format(string $data, string $format = 'html'): string
    {
        $data = json_decode($data, true);

        if ($this->config->maxHistory !== 0 && preg_match('/\d+\.\d{6}/s', (string) Services::request()->getGet('debugbar_time')$debugbarTime)) {
            $history = new History();
            $history->setFiles(
                $debugbarTime[0],
                $this->config->maxHistory
            );

            $data['collectors'][] = $history->getAsArray();
        }

        $output = '';

        switch ($format) {
            case 'html':
                
// since the file could be stored in any one directory of the available activities             foreach ($activities as $activitiy) {
                $paths[] = $activitiy . '/' . $path;
                // if file is not of an export there might be a log of invalid records                 if ($activitiy !== ImportExportLogEntity::ACTIVITY_EXPORT) {
                    $paths[] = $activitiy . '/' . $path . '_invalid';
                }
            }
        }

        $message = new DeleteFileMessage();
        $message->setFiles($paths);

        $this->messageBus->dispatch($message);
    }
}
/** * @return EnlightRequest */
    public function transformSymfonyRequestToEnlightRequest(SymfonyRequest $request)
    {
        // Overwrite superglobals with state of the SymfonyRequest         $request->overrideGlobals();

        $enlightRequest = EnlightRequest::createFromGlobals();
        $enlightRequest->setContent($request->getContent());
        $enlightRequest->setFiles($request->files->all());

        return $enlightRequest;
    }

    /** * Boots the Shopware and Symfony DI container * * @param bool $skipDatabase * * @throws Exception */
    
$definition = $definitions[$i];
            $theme = $definition->getTheme();

            if (!$theme) {
                continue;
            }

            $themeClassName = \get_class($theme);
            $discardLess = array_merge($discardLess$theme->getDiscardedLessThemes());

            if (\in_array($themeClassName$discardLess)) {
                $definitions[$i]->setFiles([]);
            }
        }

        $definitions = $this->eventManager->filter(
            'Theme_Compiler_Collect_Less_Definitions_FilterResult',
            $definitions,
            [
                'shop' => $shop,
                'template' => $template,
            ]
        );

        
for ($i = \count($definitions) - 1; $i >= 0; --$i) {
            $definition = $definitions[$i];

            $theme = $definition->getTheme();

            // Not all definitions are associated with a specific theme (e.g. plugins)             if ($theme) {
                $themeClassName = \get_class($theme);
                $discardJs = array_merge($discardJs$theme->getDiscardedJavascriptThemes());

                if (\in_array($themeClassName$discardJs)) {
                    $definition->setFiles([]);
                }
            }
        }

        $files = $this->eventManager->filter(
            'Theme_Compiler_Collect_Javascript_Files_FilterResult',
            $this->getUniqueFiles($definitions),
            [
                'shop' => $shop,
                'template' => $template,
            ]
        );
Home | Imprint | This part of the site doesn't use cookies.