ConfigTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Mview\Test\Unit;
  7. use \Magento\Framework\Mview\Config;
  8. class ConfigTest extends \PHPUnit\Framework\TestCase
  9. {
  10. /**
  11. * @var \Magento\Framework\Mview\Config
  12. */
  13. protected $model;
  14. /**
  15. * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Mview\Config\Data
  16. */
  17. protected $dataMock;
  18. protected function setUp()
  19. {
  20. $this->dataMock = $this->createMock(\Magento\Framework\Mview\Config\Data::class);
  21. $this->model = new Config(
  22. $this->dataMock
  23. );
  24. }
  25. public function testGetViews()
  26. {
  27. $this->dataMock->expects($this->once())
  28. ->method('get')
  29. ->will($this->returnValue(['some_data']));
  30. $this->assertEquals(['some_data'], $this->model->getViews());
  31. }
  32. public function testGetView()
  33. {
  34. $this->dataMock->expects($this->once())
  35. ->method('get')
  36. ->with('some_view')
  37. ->will($this->returnValue(['some_data']));
  38. $this->assertEquals(['some_data'], $this->model->getView('some_view'));
  39. }
  40. }