getDefaultConfig example

/** * @internal */
class DefaultConfigTest extends TestCase
{
    public function testDefaultConfigFromXml(): void
    {
        $cmsExtensions = CmsExtensions::createFromXmlFile(__DIR__ . '/../_fixtures/valid/cmsExtensionsWithBlocks.xml');
        static::assertNotNull($cmsExtensions->getBlocks());

        $defaultConfig = $cmsExtensions->getBlocks()->getBlocks()[0]->getDefaultConfig();

        static::assertEquals(
            [
                'marginBottom' => '5px',
                'marginTop' => '10px',
                'marginLeft' => '15px',
                'marginRight' => '20px',
                'sizingMode' => 'boxed',
                'backgroundColor' => '#000',
            ],
            $defaultConfig->toArray('en-GB')
        );
public function testFromXml(): void
    {
        $cmsExtensions = CmsExtensions::createFromXmlFile(__DIR__ . '/../_fixtures/valid/cmsExtensionsWithBlocks.xml');
        static::assertNotNull($cmsExtensions->getBlocks());

        static::assertCount(2, $cmsExtensions->getBlocks()->getBlocks());

        $firstBlock = $cmsExtensions->getBlocks()->getBlocks()[0];
        static::assertEquals('first-block-name', $firstBlock->getName());
        static::assertEquals('text-image', $firstBlock->getCategory());
        static::assertCount(3, $firstBlock->getSlots());
        static::assertCount(6, $firstBlock->getDefaultConfig()->toArray('en-GB'));
        static::assertEquals(
            [
                'en-GB' => 'First block from app',
                'de-DE' => 'Erster Block einer App',
            ],
            $firstBlock->getLabel()
        );
    }

    public function testToArray(): void
    {
        
Home | Imprint | This part of the site doesn't use cookies.