VerticalTest.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Analytics\Test\Unit\Model\Config\Source;
  7. /**
  8. * A unit test for testing of the source model for verticals configuration.
  9. */
  10. class VerticalTest extends \PHPUnit\Framework\TestCase
  11. {
  12. /**
  13. * @var \Magento\Analytics\Model\Config\Source\Vertical
  14. */
  15. private $subject;
  16. /**
  17. * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
  18. */
  19. private $objectManagerHelper;
  20. /**
  21. * @return void
  22. */
  23. protected function setUp()
  24. {
  25. $this->objectManagerHelper =
  26. new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
  27. $this->subject = $this->objectManagerHelper->getObject(
  28. \Magento\Analytics\Model\Config\Source\Vertical::class,
  29. [
  30. 'verticals' => [
  31. 'Apps and Games',
  32. 'Athletic/Sporting Goods',
  33. 'Art and Design'
  34. ]
  35. ]
  36. );
  37. }
  38. /**
  39. * @return void
  40. */
  41. public function testToOptionArray()
  42. {
  43. $expectedOptionsArray = [
  44. ['value' => '', 'label' => __('--Please Select--')],
  45. ['value' => 'Apps and Games', 'label' => __('Apps and Games')],
  46. ['value' => 'Athletic/Sporting Goods', 'label' => __('Athletic/Sporting Goods')],
  47. ['value' => 'Art and Design', 'label' => __('Art and Design')]
  48. ];
  49. $this->assertEquals(
  50. $expectedOptionsArray,
  51. $this->subject->toOptionArray()
  52. );
  53. }
  54. }