@@ -995,6 +995,75 @@ public function testGetTracking($tracking, $shipTimeStamp, $expectedDate, $expec
995995 $ this ->assertEquals ($ expectedTime , $ event ['deliverytime ' ]);
996996 }
997997
998+ /**
999+ * Test getCode with invalid type
1000+ */
1001+ public function testGetCodeWithInvalidType (): void
1002+ {
1003+ $ result = $ this ->carrier ->getCode ('invalid_type ' );
1004+ $ this ->assertFalse ($ result , 'Should return false for invalid type ' );
1005+ }
1006+
1007+ /**
1008+ * Test getCode with valid type and no code (returns all codes)
1009+ */
1010+ public function testGetCodeWithValidTypeNoCode (): void
1011+ {
1012+ $ result = $ this ->carrier ->getCode ('method ' );
1013+ $ this ->assertIsArray ($ result , 'Should return array of all method codes ' );
1014+ $ this ->assertArrayHasKey ('FEDEX_INTERNATIONAL_PRIORITY ' , $ result );
1015+ $ this ->assertArrayHasKey ('FEDEX_INTERNATIONAL_PRIORITY_EXPRESS ' , $ result );
1016+ $ this ->assertEquals (__ ('FedEx International Priority ' ), $ result ['FEDEX_INTERNATIONAL_PRIORITY ' ]);
1017+ }
1018+
1019+ /**
1020+ * Test getCode with valid type and valid code
1021+ */
1022+ public function testGetCodeWithValidTypeAndCode (): void
1023+ {
1024+ $ result = $ this ->carrier ->getCode ('method ' , 'FEDEX_INTERNATIONAL_PRIORITY ' );
1025+ $ this ->assertInstanceOf (
1026+ \Magento \Framework \Phrase::class,
1027+ $ result ,
1028+ 'Should return Phrase object for valid method code '
1029+ );
1030+ $ this ->assertEquals ('FedEx International Priority ' , $ result ->getText ());
1031+ }
1032+
1033+ /**
1034+ * Test getCode with valid type and invalid code
1035+ */
1036+ public function testGetCodeWithValidTypeAndInvalidCode (): void
1037+ {
1038+ $ result = $ this ->carrier ->getCode ('method ' , 'INVALID_CODE ' );
1039+ $ this ->assertFalse ($ result );
1040+ }
1041+
1042+ /**
1043+ * Test getCode with packaging type
1044+ */
1045+ public function testGetCodeWithPackagingType (): void
1046+ {
1047+ $ result = $ this ->carrier ->getCode ('packaging ' , 'FEDEX_ENVELOPE ' );
1048+ $ this ->assertInstanceOf (
1049+ \Magento \Framework \Phrase::class,
1050+ $ result ,
1051+ 'Should return Phrase object for valid packaging code '
1052+ );
1053+ $ this ->assertEquals ('FedEx Envelope ' , $ result ->getText ());
1054+ }
1055+
1056+ /**
1057+ * Test getCode with dropoff type and empty code
1058+ */
1059+ public function testGetCodeWithDropoffTypeNoCode (): void
1060+ {
1061+ $ result = $ this ->carrier ->getCode ('dropoff ' );
1062+ $ this ->assertIsArray ($ result , 'Should return array of all dropoff codes ' );
1063+ $ this ->assertArrayHasKey ('REGULAR_PICKUP ' , $ result );
1064+ $ this ->assertEquals (__ ('Regular Pickup ' ), $ result ['REGULAR_PICKUP ' ]);
1065+ }
1066+
9981067 /**
9991068 * Gets list of variations for testing ship date.
10001069 *
@@ -1065,7 +1134,7 @@ public static function shipDateDataProvider(): array
10651134 ],
10661135 'tracking8 ' => [
10671136 'tracking8 ' ,
1068- 'shipTimestamp ' => '2024-09-19T02:06:35+03:00 ' ,
1137+ 'shipTimeStamp ' => '2024-09-19T02:06:35+03:00 ' ,
10691138 'expectedDate ' => '2024-09-21 ' ,
10701139 '18:31:00 ' ,
10711140 true
0 commit comments