ConfigTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Ups\Test\Unit\Helper;
  7. /**
  8. * Config helper Test
  9. */
  10. class ConfigTest extends \PHPUnit\Framework\TestCase
  11. {
  12. /**
  13. * Ups config helper
  14. *
  15. * @var \Magento\Ups\Helper\Config
  16. */
  17. protected $helper;
  18. protected function setUp()
  19. {
  20. $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
  21. $this->helper = $objectManagerHelper->getObject(\Magento\Ups\Helper\Config::class);
  22. }
  23. /**
  24. * @param mixed $result
  25. * @param null|string $type
  26. * @param string $code
  27. * @dataProvider getCodeDataProvider
  28. */
  29. public function testGetData($result, $type = null, $code = null)
  30. {
  31. $this->assertEquals($result, $this->helper->getCode($type, $code));
  32. }
  33. /**
  34. * Data provider
  35. *
  36. * @return array
  37. */
  38. public function getCodeDataProvider()
  39. {
  40. return [
  41. [false],
  42. [false, 'not-exist-type'],
  43. [false, 'not-exist-type', 'not-exist-code'],
  44. [false, 'action'],
  45. [['single' => '3', 'all' => '4'], 'action', ''],
  46. ['3', 'action', 'single']
  47. ];
  48. }
  49. }