StaticFileConfigLoader example

/** * @internal */
class StaticFileConfigLoaderTest 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 StaticFileConfigLoader($fs);
        $s->load(Uuid::randomHex(), Context::createDefaultContext());
    }

    public function testBuild(): void
    {
        $id = Uuid::randomHex();

        $fs = new Filesystem(new InMemoryFilesystemAdapter());
        $fs->write('theme-config/' . $id . '.json', (string) file_get_contents(__DIR__ . '/../fixtures/ConfigLoader/theme-config.json'));

        $s = new StaticFileConfigLoader($fs);
        
Home | Imprint | This part of the site doesn't use cookies.