DesignLoaderTest.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\View\Test\Unit;
  7. class DesignLoaderTest extends \PHPUnit\Framework\TestCase
  8. {
  9. /**
  10. * @var \Magento\Framework\View\DesignLoader
  11. */
  12. protected $_model;
  13. /**
  14. * @var \PHPUnit_Framework_MockObject_MockObject
  15. */
  16. protected $_areaListMock;
  17. /**
  18. * @var \PHPUnit_Framework_MockObject_MockObject
  19. */
  20. protected $_requestMock;
  21. /**
  22. * @var \Magento\Framework\App\State|\PHPUnit_Framework_MockObject_MockObject
  23. */
  24. protected $appState;
  25. protected function setUp()
  26. {
  27. $this->_areaListMock = $this->createMock(\Magento\Framework\App\AreaList::class);
  28. $this->_requestMock = $this->createMock(\Magento\Framework\App\Request\Http::class);
  29. $this->appState = $this->createMock(\Magento\Framework\App\State::class);
  30. $this->_model = new \Magento\Framework\View\DesignLoader(
  31. $this->_requestMock,
  32. $this->_areaListMock,
  33. $this->appState
  34. );
  35. }
  36. public function testLoad()
  37. {
  38. $area = $this->createMock(\Magento\Framework\App\Area::class);
  39. $this->appState->expects($this->once())->method('getAreaCode')->will($this->returnValue('area'));
  40. $this->_areaListMock->expects($this->once())->method('getArea')->with('area')->will($this->returnValue($area));
  41. $area->expects($this->at(0))->method('load')
  42. ->with(\Magento\Framework\App\Area::PART_DESIGN)->will($this->returnValue($area));
  43. $area->expects($this->at(1))->method('load')
  44. ->with(\Magento\Framework\App\Area::PART_TRANSLATE)->will($this->returnValue($area));
  45. $this->_model->load($this->_requestMock);
  46. }
  47. }