File: /home/petsclubcc/magento/vendor/magento/module-store/Test/Unit/Model/Resolver/StoreTest.php
<?php
/**
*
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Store\Test\Unit\Model\Resolver;
use \Magento\Store\Model\Resolver\Store;
/**
* Test class for \Magento\Store\Model\Resolver\Store
*/
class StoreTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Store
*/
protected $_model;
/**
* @var \PHPUnit_Framework_MockObject_MockObject
*/
protected $_storeManagerMock;
protected function setUp()
{
$this->_storeManagerMock = $this->getMock(
'Magento\Store\Model\StoreManagerInterface',
[],
[],
'',
false,
false
);
$this->_model = new Store($this->_storeManagerMock);
}
protected function tearDown()
{
unset($this->_storeManagerMock);
}
public function testGetScope()
{
$scopeMock = $this->getMock('Magento\Framework\App\ScopeInterface', [], [], '', false, false);
$this->_storeManagerMock
->expects($this->once())
->method('getStore')
->with(0)
->will($this->returnValue($scopeMock));
$this->assertEquals($scopeMock, $this->_model->getScope());
}
/**
* @expectedException \Magento\Framework\Exception\State\InitException
*/
public function testGetScopeWithInvalidScope()
{
$scopeMock = new \StdClass();
$this->_storeManagerMock
->expects($this->once())
->method('getStore')
->with(0)
->will($this->returnValue($scopeMock));
$this->assertEquals($scopeMock, $this->_model->getScope());
}
}