DataTest.php 2.49 KB
Newer Older
Ketan's avatar
Ketan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Magento\Usps\Test\Unit\Helper;

class DataTest extends \PHPUnit\Framework\TestCase
{
    /**
     * @var \Magento\Usps\Helper\Data
     */
    protected $_helperData;

    protected function setUp()
    {
        $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
        $arguments = [
            'context' => $this->createMock(\Magento\Framework\App\Helper\Context::class),
        ];

        $this->_helperData = $helper->getObject(\Magento\Usps\Helper\Data::class, $arguments);
    }

    /**
     * @covers \Magento\Usps\Helper\Data::displayGirthValue
     * @dataProvider shippingMethodDataProvider
     */
    public function testDisplayGirthValue($shippingMethod)
    {
        $this->assertTrue($this->_helperData->displayGirthValue($shippingMethod));
    }

    /**
     * @covers \Magento\Usps\Helper\Data::displayGirthValue
     */
    public function testDisplayGirthValueFalse()
    {
        $this->assertFalse($this->_helperData->displayGirthValue('test_shipping_method'));
    }

    /**
     * @return array shipping method name
     */
    public function shippingMethodDataProvider()
    {
        return [
            ['usps_0_FCLE'],   // First-Class Mail Large Envelope
            ['usps_1'],        // Priority Mail
            ['usps_2'],        // Priority Mail Express Hold For Pickup
            ['usps_3'],        // Priority Mail Express
            ['usps_4'],        // Retail Ground
            ['usps_6'],        // Media Mail
            ['usps_INT_1'],    // Priority Mail Express International
            ['usps_INT_2'],    // Priority Mail International
            ['usps_INT_4'],    // Global Express Guaranteed (GXG)
            ['usps_INT_7'],    // Global Express Guaranteed Non-Document Non-Rectangular
            ['usps_INT_8'],    // Priority Mail International Flat Rate Envelope
            ['usps_INT_9'],    // Priority Mail International Medium Flat Rate Box
            ['usps_INT_10'],   // Priority Mail Express International Flat Rate Envelope
            ['usps_INT_11'],   // Priority Mail International Large Flat Rate Box
            ['usps_INT_12'],   // USPS GXG Envelopes
            ['usps_INT_14'],   // First-Class Mail International Large Envelope
            ['usps_INT_16'],   // Priority Mail International Small Flat Rate Box
            ['usps_INT_20'],   // Priority Mail International Small Flat Rate Envelope
        ];
    }
}