@@ -206,6 +206,44 @@ public function testCollectRates(int $negotiable, int $tax, int $responseId, str
206206 $ this ->assertTrue ($ requestFound );
207207 }
208208
209+ /**
210+ * Test collect rates function without any allowed methods set.
211+ *
212+ * @return void
213+ * @magentoConfigFixture default_store shipping/origin/country_id GB
214+ * @magentoConfigFixture default_store carriers/ups/type UPS_XML
215+ * @magentoConfigFixture default_store carriers/ups/active 1
216+ * @magentoConfigFixture default_store carriers/ups/shipper_number 12345
217+ * @magentoConfigFixture default_store carriers/ups/origin_shipment Shipments Originating in the European Union
218+ * @magentoConfigFixture default_store carriers/ups/username user
219+ * @magentoConfigFixture default_store carriers/ups/password pass
220+ * @magentoConfigFixture default_store carriers/ups/access_license_number acn
221+ * @magentoConfigFixture default_store carriers/ups/debug 1
222+ * @magentoConfigFixture default_store currency/options/allow GBP,USD,EUR
223+ * @magentoConfigFixture default_store currency/options/base GBP
224+ */
225+ public function testCollectRatesWithoutAnyAllowedMethods (): void
226+ {
227+ $ request = Bootstrap::getObjectManager ()->create (
228+ RateRequest::class,
229+ [
230+ 'data ' => [
231+ 'dest_country ' => 'GB ' ,
232+ 'dest_postal ' => '01104 ' ,
233+ 'product ' => '11 ' ,
234+ 'action ' => 'Rate ' ,
235+ 'unit_measure ' => 'KGS ' ,
236+ 'base_currency ' => new DataObject (['code ' => 'GBP ' ])
237+ ]
238+ ]
239+ );
240+ $ this ->config ->setValue ('carriers/ups/allowed_methods ' , '' , 'store ' );
241+ $ rates = $ this ->carrier ->collectRates ($ request )->getAllRates ();
242+ $ this ->assertInstanceOf (Error::class, current ($ rates ));
243+ $ this ->assertEquals (current ($ rates )['carrier_title ' ], $ this ->carrier ->getConfigData ('title ' ));
244+ $ this ->assertEquals (current ($ rates )['error_message ' ], $ this ->carrier ->getConfigData ('specificerrmsg ' ));
245+ }
246+
209247 /**
210248 * Get list of rates variations
211249 *
0 commit comments