![]() 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-config/Test/Unit/Model/Config/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Config\Test\Unit\Model\Config; use Magento\Config\Model\Config\ScopeDefiner; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\RequestInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Store\Model\ScopeInterface; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class ScopeDefinerTest extends TestCase { /** * @var ScopeDefiner */ protected $_model; /** * @var MockObject */ protected $_requestMock; protected function setUp(): void { $this->_requestMock = $this->getMockForAbstractClass(RequestInterface::class); $objectManager = new ObjectManager($this); $this->_model = $objectManager->getObject( ScopeDefiner::class, ['request' => $this->_requestMock] ); } public function testGetScopeReturnsDefaultScopeIfNoScopeDataIsSpecified() { $this->assertEquals(ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $this->_model->getScope()); } public function testGetScopeReturnsStoreScopeIfStoreIsSpecified() { $this->_requestMock->expects( $this->any() )->method( 'getParam' )->willReturnMap( [['website', null, 'someWebsite'], ['store', null, 'someStore']] ); $this->assertEquals(ScopeInterface::SCOPE_STORE, $this->_model->getScope()); } public function testGetScopeReturnsWebsiteScopeIfWebsiteIsSpecified() { $this->_requestMock->expects( $this->any() )->method( 'getParam' )->willReturnMap( [['website', null, 'someWebsite'], ['store', null, null]] ); $this->assertEquals(ScopeInterface::SCOPE_WEBSITE, $this->_model->getScope()); } }