| 1 |
<?php |
| 2 |
|
| 3 |
declare( strict_types=1 ); |
| 4 |
|
| 5 |
namespace Tests\Module\Shipping; |
| 6 |
|
| 7 |
use Packetery\Module\Shipping\BaseShippingMethod; |
| 8 |
use Packetery\Module\Shipping\ShippingProvider; |
| 9 |
use Packetery\Module\ShippingMethod; |
| 10 |
use PHPUnit\Framework\TestCase; |
| 11 |
|
| 12 |
class ShippingProviderTest extends TestCase { |
| 13 |
/** |
| 14 |
* @return array |
| 15 |
*/ |
| 16 |
public static function shippingMethodsProvider(): array { |
| 17 |
return [ |
| 18 |
[ |
| 19 |
'methodId' => 'free_shipping', |
| 20 |
'isPacketaMethod' => false, |
| 21 |
], |
| 22 |
[ |
| 23 |
'methodId' => 'flat_rate', |
| 24 |
'isPacketaMethod' => false, |
| 25 |
], |
| 26 |
[ |
| 27 |
'methodId' => ShippingMethod::PACKETERY_METHOD_ID, |
| 28 |
'isPacketaMethod' => true, |
| 29 |
], |
| 30 |
[ |
| 31 |
'methodId' => BaseShippingMethod::PACKETA_METHOD_PREFIX . 'zpointcz', |
| 32 |
'isPacketaMethod' => true, |
| 33 |
], |
| 34 |
[ |
| 35 |
'methodId' => BaseShippingMethod::PACKETA_METHOD_PREFIX . 'czzpoint', |
| 36 |
'isPacketaMethod' => true, |
| 37 |
], |
| 38 |
[ |
| 39 |
'methodId' => BaseShippingMethod::PACKETA_METHOD_PREFIX . '106', |
| 40 |
'isPacketaMethod' => true, |
| 41 |
], |
| 42 |
]; |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* @dataProvider shippingMethodsProvider |
| 47 |
*/ |
| 48 |
public function testIsPacketaMethod( $methodId, $isPacketaMethod ): void { |
| 49 |
self::assertEquals( $isPacketaMethod, ShippingProvider::isPacketaMethod( $methodId ) ); |
| 50 |
} |
| 51 |
} |
| 52 |
|