Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/magento/module-theme/Test/Unit/Model/Layout/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/magento/module-theme/Test/Unit/Model/Layout/ConfigTest.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace Magento\Theme\Test\Unit\Model\Layout;

use Magento\Framework\Config\DataInterface;
use Magento\Framework\DataObject;
use Magento\Theme\Model\Layout\Config;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

class ConfigTest extends TestCase
{
    /**
     * @var Config
     */
    protected $_model;

    /**
     * @var DataInterface|MockObject
     */
    protected $dataStorage;

    protected function setUp(): void
    {
        $this->dataStorage = $this->getMockBuilder(DataInterface::class)
            ->disableOriginalConstructor()
            ->getMockForAbstractClass();
        $this->_model = new Config($this->dataStorage);
    }

    /**
     * @test
     * @return void
     * @covers \Magento\Theme\Model\Layout\Config::getPageLayouts
     * @covers \Magento\Theme\Model\Layout\Config::getPageLayout
     * @covers \Magento\Theme\Model\Layout\Config::getPageLayoutHandles
     * @covers \Magento\Theme\Model\Layout\Config::_initPageLayouts
     * @covers \Magento\Theme\Model\Layout\Config::__construct
     */
    public function testGetPageLayout()
    {
        $data = ['code' => ['label' => 'Test Label', 'code' => 'testCode']];
        $expectedResult = [
            'code' => new DataObject(['label' => __('Test Label'), 'code' => 'testCode']),
        ];

        $this->dataStorage->expects($this->once())
            ->method('get')
            ->with(null, null)
            ->willReturn($data);

        $this->assertEquals($expectedResult, $this->_model->getPageLayouts());
        $this->assertEquals($expectedResult['code'], $this->_model->getPageLayout('code'));
        $this->assertFalse($this->_model->getPageLayout('wrong_code'));
        $this->assertEquals(
            [$expectedResult['code']['code'] => $expectedResult['code']['code']],
            $this->_model->getPageLayoutHandles()
        );
    }
}

Spamworldpro Mini