DataTest.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Usps\Test\Unit\Helper;
  7. class DataTest extends \PHPUnit\Framework\TestCase
  8. {
  9. /**
  10. * @var \Magento\Usps\Helper\Data
  11. */
  12. protected $_helperData;
  13. protected function setUp()
  14. {
  15. $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
  16. $arguments = [
  17. 'context' => $this->createMock(\Magento\Framework\App\Helper\Context::class),
  18. ];
  19. $this->_helperData = $helper->getObject(\Magento\Usps\Helper\Data::class, $arguments);
  20. }
  21. /**
  22. * @covers \Magento\Usps\Helper\Data::displayGirthValue
  23. * @dataProvider shippingMethodDataProvider
  24. */
  25. public function testDisplayGirthValue($shippingMethod)
  26. {
  27. $this->assertTrue($this->_helperData->displayGirthValue($shippingMethod));
  28. }
  29. /**
  30. * @covers \Magento\Usps\Helper\Data::displayGirthValue
  31. */
  32. public function testDisplayGirthValueFalse()
  33. {
  34. $this->assertFalse($this->_helperData->displayGirthValue('test_shipping_method'));
  35. }
  36. /**
  37. * @return array shipping method name
  38. */
  39. public function shippingMethodDataProvider()
  40. {
  41. return [
  42. ['usps_0_FCLE'], // First-Class Mail Large Envelope
  43. ['usps_1'], // Priority Mail
  44. ['usps_2'], // Priority Mail Express Hold For Pickup
  45. ['usps_3'], // Priority Mail Express
  46. ['usps_4'], // Retail Ground
  47. ['usps_6'], // Media Mail
  48. ['usps_INT_1'], // Priority Mail Express International
  49. ['usps_INT_2'], // Priority Mail International
  50. ['usps_INT_4'], // Global Express Guaranteed (GXG)
  51. ['usps_INT_7'], // Global Express Guaranteed Non-Document Non-Rectangular
  52. ['usps_INT_8'], // Priority Mail International Flat Rate Envelope
  53. ['usps_INT_9'], // Priority Mail International Medium Flat Rate Box
  54. ['usps_INT_10'], // Priority Mail Express International Flat Rate Envelope
  55. ['usps_INT_11'], // Priority Mail International Large Flat Rate Box
  56. ['usps_INT_12'], // USPS GXG Envelopes
  57. ['usps_INT_14'], // First-Class Mail International Large Envelope
  58. ['usps_INT_16'], // Priority Mail International Small Flat Rate Box
  59. ['usps_INT_20'], // Priority Mail International Small Flat Rate Envelope
  60. ];
  61. }
  62. }