This repository was archived by the owner on Oct 24, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +9
-0
lines changed
src/Core/Request/ShippingMethods
tests/integration/ShippingMethod Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change 55
66namespace Commercetools \Core \Request \ShippingMethods ;
77
8+ use Commercetools \Core \Request \ExpandTrait ;
89use Commercetools \Core \Response \ResourceResponse ;
910use Psr \Http \Message \ResponseInterface ;
1011use Commercetools \Core \Client \HttpMethod ;
2425 */
2526class ShippingMethodByCartIdGetRequest extends AbstractApiRequest
2627{
28+ use ExpandTrait;
29+
2730 protected $ resultClass = ShippingMethodCollection::class;
2831
2932 /**
Original file line number Diff line number Diff line change 55
66namespace Commercetools \Core \Request \ShippingMethods ;
77
8+ use Commercetools \Core \Request \ExpandTrait ;
89use Commercetools \Core \Response \ResourceResponse ;
910use Psr \Http \Message \ResponseInterface ;
1011use Commercetools \Core \Client \HttpMethod ;
2425 */
2526class ShippingMethodByLocationGetRequest extends AbstractApiRequest
2627{
28+ use ExpandTrait;
29+
2730 protected $ resultClass = ShippingMethodCollection::class;
2831
2932 /**
Original file line number Diff line number Diff line change 1515use Commercetools \Core \Model \ShippingMethod \ShippingRateCollection ;
1616use Commercetools \Core \Model \ShippingMethod \ZoneRate ;
1717use Commercetools \Core \Model \ShippingMethod \ZoneRateCollection ;
18+ use Commercetools \Core \Model \TaxCategory \TaxCategory ;
1819use Commercetools \Core \Request \ShippingMethods \ShippingMethodByIdGetRequest ;
1920use Commercetools \Core \Request \ShippingMethods \ShippingMethodByLocationGetRequest ;
2021use Commercetools \Core \Request \ShippingMethods \ShippingMethodCreateRequest ;
@@ -92,11 +93,13 @@ public function testByLocation()
9293 $ shippingMethod = $ this ->createShippingMethod ($ draft );
9394
9495 $ request = ShippingMethodByLocationGetRequest::ofCountry ('DE ' )->withState ($ this ->getRegion ());
96+ $ request ->expand ('taxCategory.id ' );
9597 $ response = $ request ->executeWithClient ($ this ->getClient (), ['X-Vrap-Disable-Validation ' => 'response ' ]);
9698 $ result = $ request ->mapResponse ($ response );
9799
98100 $ this ->assertTrue ($ result ->current ()->getZoneRates ()->current ()->getShippingRates ()->current ()->getIsMatching ());
99101 $ this ->assertInstanceOf (ShippingMethodCollection::class, $ result );
100102 $ this ->assertSame ($ shippingMethod ->getId (), $ result ->current ()->getId ());
103+ $ this ->assertInstanceOf (TaxCategory::class, $ result ->current ()->getTaxCategory ()->getObj ());
101104 }
102105}
You can’t perform that action at this time.
0 commit comments