Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
DesignLoaderTest.php
Go to the documentation of this file.
1 <?php
8 
9 class DesignLoaderTest extends \PHPUnit\Framework\TestCase
10 {
14  protected $_model;
15 
19  protected $_areaListMock;
20 
24  protected $_requestMock;
25 
29  protected $appState;
30 
31  protected function setUp()
32  {
33  $this->_areaListMock = $this->createMock(\Magento\Framework\App\AreaList::class);
34  $this->_requestMock = $this->createMock(\Magento\Framework\App\Request\Http::class);
35  $this->appState = $this->createMock(\Magento\Framework\App\State::class);
36  $this->_model = new \Magento\Framework\View\DesignLoader(
37  $this->_requestMock,
38  $this->_areaListMock,
39  $this->appState
40  );
41  }
42 
43  public function testLoad()
44  {
45  $area = $this->createMock(\Magento\Framework\App\Area::class);
46  $this->appState->expects($this->once())->method('getAreaCode')->will($this->returnValue('area'));
47  $this->_areaListMock->expects($this->once())->method('getArea')->with('area')->will($this->returnValue($area));
48  $area->expects($this->at(0))->method('load')
49  ->with(\Magento\Framework\App\Area::PART_DESIGN)->will($this->returnValue($area));
50  $area->expects($this->at(1))->method('load')
51  ->with(\Magento\Framework\App\Area::PART_TRANSLATE)->will($this->returnValue($area));
52  $this->_model->load($this->_requestMock);
53  }
54 }