_requestMock = $this->createMock(\Magento\Framework\App\RequestInterface::class); $objectManager = new ObjectManager($this); $this->_model = $objectManager->getObject( \Magento\Config\Model\Config\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' )->will( $this->returnValueMap([['website', null, 'someWebsite'], ['store', null, 'someStore']]) ); $this->assertEquals(\Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->_model->getScope()); } public function testGetScopeReturnsWebsiteScopeIfWebsiteIsSpecified() { $this->_requestMock->expects( $this->any() )->method( 'getParam' )->will( $this->returnValueMap([['website', null, 'someWebsite'], ['store', null, null]]) ); $this->assertEquals(\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE, $this->_model->getScope()); } }