StaticFileAvailableThemeProvider example


class StaticFileAvailableThemeProviderTest extends TestCase
{
    public function testFileNotExisting(): void
    {
        static::expectException(\RuntimeException::class);
        static::expectExceptionMessage('Cannot find theme configuration. Did you run bin/console theme:dump');

        $fs = new Filesystem(new InMemoryFilesystemAdapter());
        $s = new StaticFileAvailableThemeProvider($fs);
        $s->load(Context::createDefaultContext(), false);
    }

    public function testFileExists(): void
    {
        $fs = new Filesystem(new InMemoryFilesystemAdapter());
        $fs->write(StaticFileAvailableThemeProvider::THEME_INDEX, json_encode(['test' => 'test'], \JSON_THROW_ON_ERROR));

        $s = new StaticFileAvailableThemeProvider($fs);
        static::assertSame(['test' => 'test']$s->load(Context::createDefaultContext(), false));
    }

    
Home | Imprint | This part of the site doesn't use cookies.