TopDestinationCountriesTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Directory\Test\Unit\Model;
  7. class TopDestinationCountriesTest extends \PHPUnit\Framework\TestCase
  8. {
  9. /**
  10. * @var \Magento\Framework\App\Config\ScopeConfigInterface
  11. */
  12. protected $scopeConfigMock;
  13. /**
  14. * @var \Magento\Directory\Model\TopDestinationCountries
  15. */
  16. protected $model;
  17. protected function setUp()
  18. {
  19. $this->scopeConfigMock = $this->getMockBuilder(\Magento\Framework\App\Config\ScopeConfigInterface::class)
  20. ->getMock();
  21. $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
  22. $arguments = [
  23. 'scopeConfig' => $this->scopeConfigMock
  24. ];
  25. $this->model = $objectManager
  26. ->getObject(\Magento\Directory\Model\TopDestinationCountries::class, $arguments);
  27. }
  28. /**
  29. * @dataProvider toTestGetTopDestinationsDataProvider
  30. */
  31. public function testGetTopDestinations($options, $expectedResults)
  32. {
  33. $this->scopeConfigMock->expects($this->once())->method('getValue')->willReturn($options);
  34. $this->assertEquals($expectedResults, $this->model->getTopDestinations());
  35. }
  36. /**
  37. * @return array
  38. */
  39. public function toTestGetTopDestinationsDataProvider()
  40. {
  41. return [
  42. ['UA,AF', ['UA', 'AF']],
  43. ['', []]
  44. ];
  45. }
  46. }