From c6b4328a5fd1c7021ed7e495ecabf6dd896f1639 Mon Sep 17 00:00:00 2001 From: Jens Schulze Date: Fri, 2 Jun 2017 13:37:04 +0200 Subject: [PATCH] feat(ShippingMethod): add isMatching flag to shipping rates --- src/Core/Model/ShippingMethod/ShippingRate.php | 3 +++ tests/fixtures/models.yaml | 1 + .../ShippingMethod/ShippingMethodQueryRequestTest.php | 1 + 3 files changed, 5 insertions(+) diff --git a/src/Core/Model/ShippingMethod/ShippingRate.php b/src/Core/Model/ShippingMethod/ShippingRate.php index 17407e089d..2e49e22034 100644 --- a/src/Core/Model/ShippingMethod/ShippingRate.php +++ b/src/Core/Model/ShippingMethod/ShippingRate.php @@ -15,6 +15,8 @@ * @method ShippingRate setPrice(Money $price = null) * @method Money getFreeAbove() * @method ShippingRate setFreeAbove(Money $freeAbove = null) + * @method bool getIsMatching() + * @method ShippingRate setIsMatching(bool $isMatching = null) */ class ShippingRate extends JsonObject { @@ -23,6 +25,7 @@ public function fieldDefinitions() return [ 'price' => [static::TYPE => Money::class], 'freeAbove' => [static::TYPE => Money::class], + 'isMatching' => [static::TYPE => 'bool'] ]; } } diff --git a/tests/fixtures/models.yaml b/tests/fixtures/models.yaml index 54fcbba538..814e625c80 100644 --- a/tests/fixtures/models.yaml +++ b/tests/fixtures/models.yaml @@ -630,6 +630,7 @@ shippingRate: fields: - price - freeAbove + - isMatching state: domain: state diff --git a/tests/integration/ShippingMethod/ShippingMethodQueryRequestTest.php b/tests/integration/ShippingMethod/ShippingMethodQueryRequestTest.php index 4738993e8a..b2db5ee6f2 100644 --- a/tests/integration/ShippingMethod/ShippingMethodQueryRequestTest.php +++ b/tests/integration/ShippingMethod/ShippingMethodQueryRequestTest.php @@ -95,6 +95,7 @@ public function testByLocation() $response = $request->executeWithClient($this->getClient(), ['X-Vrap-Disable-Validation' => 'response']); $result = $request->mapResponse($response); + $this->assertTrue($result->current()->getZoneRates()->current()->getShippingRates()->current()->getIsMatching()); $this->assertInstanceOf(ShippingMethodCollection::class, $result); $this->assertSame($shippingMethod->getId(), $result->current()->getId()); }