tests/Model/BlockInteractorTest.php
/**
     * Test createNewContainer() method with some values.
     */
Test createNewContainer() method with some values.
Test createNewContainer () method with some values .
public function testCreateNewContainer(): void
    {
        $registry = $this->createMock(ManagerRegistry::class);
        $blockManager = $this->createMock(BlockManagerInterface::class);
        $blockManager->method('create')->willReturn(new Block());
        $blockInteractor = new BlockInteractor($registry, $blockManager);
        $container = $blockInteractor->createNewContainer([
            'enabled' => true,
            'code' => 'my-code',
        ], static function ($container) {
            $container->setSetting('layout', '<div class="custom-layout">{{ CONTENT }}</div>');
        });
        static::assertInstanceOf(BlockInterface::class, $container);
        $settings = $container->getSettings();
        static::assertTrue($container->getEnabled());
        static::assertSame('my-code', $settings['code']);
        static::assertSame('<div class="custom-layout">{{ CONTENT }}</div>', $settings['layout']);
    }
public function testCreateNewContainer ( ) : void { $ registry = $ this -> createMock ( ManagerRegistry :: class ) ; $ blockManager = $ this -> createMock ( BlockManagerInterface :: class ) ; $ blockManager -> method ( 'create' ) -> willReturn ( new Block ( ) ) ; $ blockInteractor = new BlockInteractor ( $ registry , $ blockManager ) ; $ container = $ blockInteractor -> createNewContainer ( [ 'enabled' => true , 'code' => 'my-code' , ] , static function ( $ container ) { $ container -> setSetting ( 'layout' , '<div class="custom-layout">{{ CONTENT }}</div>' ) ; } ) ; static :: assertInstanceOf ( BlockInterface :: class , $ container ) ; $ settings = $ container -> getSettings ( ) ; static :: assertTrue ( $ container -> getEnabled ( ) ) ; static :: assertSame ( 'my-code' , $ settings [ 'code' ] ) ; static :: assertSame ( '<div class="custom-layout">{{ CONTENT }}</div>' , $ settings [ 'layout' ] ) ; }
Test createNewContainer() method with some values.
Test createNewContainer () method with some values .