Skip to content

Commit

Permalink
GraphQL-423: Replaced as integer parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksLi committed Mar 27, 2019
1 parent d39e99b commit 40061f8
Showing 1 changed file with 15 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ protected function setUp()

/**
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_virtual_product_and_address.php
* @magentoApiDataFixture Magento/Checkout/_files/enable_all_shipping_methods.php
* @throws \Exception
*/
public function testShippingMethodWithVirtualProduct()
Expand Down Expand Up @@ -105,15 +104,14 @@ public function testShippingMethodWithVirtualProduct()
$maskedQuoteId,
'flatrate',
'flatrate_flatrate',
$shippingAddress->getId()
(int)$shippingAddress->getId()
);

$this->graphQlQuery($mutation, [], '', $this->getHeaderMap());
}

/**
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php
* @magentoApiDataFixture Magento/Checkout/_files/enable_all_shipping_methods.php
* @throws \Exception
*/
public function testShippingMethodWithSimpleProduct()
Expand Down Expand Up @@ -146,7 +144,7 @@ public function testShippingMethodWithSimpleProduct()
$maskedQuoteId,
'flatrate',
'flatrate',
$shippingAddress->getId()
(int)$shippingAddress->getId()
);

$this->graphQlQuery($mutation, [], '', $this->getHeaderMap());
Expand All @@ -155,7 +153,6 @@ public function testShippingMethodWithSimpleProduct()
/**
* @magentoApiDataFixture Magento/Customer/_files/customer.php
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
* @magentoApiDataFixture Magento/Checkout/_files/enable_all_shipping_methods.php
* @throws \Exception
*/
public function testShippingMethodWithSimpleProductWithoutAddress()
Expand Down Expand Up @@ -183,7 +180,7 @@ public function testShippingMethodWithSimpleProductWithoutAddress()
$maskedQuoteId,
'flatrate',
'flatrate',
$shippingAddress->getId()
(int)$shippingAddress->getId()
);

self::expectExceptionMessage(
Expand All @@ -204,7 +201,7 @@ public function testSetShippingMethodWithMissedRequiredParameters()
$maskedQuoteId,
'',
'',
'1'
1
);

self::expectExceptionMessage(
Expand All @@ -215,7 +212,6 @@ public function testSetShippingMethodWithMissedRequiredParameters()

/**
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php
* @magentoApiDataFixture Magento/Checkout/_files/enable_all_shipping_methods.php
* @throws \Exception
*/
public function testSetNonExistentShippingMethod()
Expand Down Expand Up @@ -248,7 +244,7 @@ public function testSetNonExistentShippingMethod()
$maskedQuoteId,
'non-existed-method-code',
'non-existed-carrier-code',
$shippingAddress->getId()
(int)$shippingAddress->getId()
);

self::expectExceptionMessage(
Expand All @@ -261,7 +257,6 @@ public function testSetNonExistentShippingMethod()
/**
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php
* @magentoApiDataFixture Magento/Customer/_files/customer_two_addresses.php
* @magentoApiDataFixture Magento/Checkout/_files/enable_all_shipping_methods.php
* @throws \Exception
*/
public function testSetShippingMethodIfAddressIsNotBelongToCart()
Expand Down Expand Up @@ -294,7 +289,7 @@ public function testSetShippingMethodIfAddressIsNotBelongToCart()
$maskedQuoteId,
'flatrate',
'flatrate',
'2'
2
);

self::expectExceptionMessage(
Expand All @@ -317,7 +312,7 @@ public function testSetShippingMethodToNonExistentCart()
$maskedQuoteId,
'flatrate',
'flatrate',
'80900'
80900
);

$this->graphQlQuery($mutation, [], '', $this->getHeaderMap());
Expand All @@ -340,7 +335,7 @@ public function testSetShippingMethodToGuestCart()
$maskedQuoteId,
'flatrate',
'flatrate',
$quote->getShippingAddress()->getId()
(int)$quote->getShippingAddress()->getId()
);

$this->graphQlQuery($mutation);
Expand All @@ -363,7 +358,7 @@ public function testSetShippingMethodToAnotherCustomerCart()
$maskedQuoteId,
'flatrate',
'flatrate',
$quote->getShippingAddress()->getId()
(int)$quote->getShippingAddress()->getId()
);

self::expectExceptionMessage(
Expand All @@ -384,7 +379,7 @@ public function testSetShippingMethodToNonExistentCartAddress()
$maskedQuoteId,
'flatrate',
'flatrate',
'16800'
16800
);
self::expectExceptionMessage(
'Could not find a cart address with ID "16800"'
Expand All @@ -395,7 +390,6 @@ public function testSetShippingMethodToNonExistentCartAddress()

/**
* @magentoApiDataFixture Magento/Sales/_files/guest_quote_with_addresses.php
* @magentoApiDataFixture Magento/Checkout/_files/enable_all_shipping_methods.php
* @throws \Exception
*/
public function testSetShippingMethodToGuestCartAddress()
Expand All @@ -410,7 +404,7 @@ public function testSetShippingMethodToGuestCartAddress()
$maskedQuoteId,
'flatrate',
'flatrate',
$quote->getShippingAddress()->getId()
(int)$quote->getShippingAddress()->getId()
);

$this->graphQlQuery($mutation);
Expand All @@ -419,7 +413,6 @@ public function testSetShippingMethodToGuestCartAddress()
/**
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_virtual_product_and_address.php
* @magentoApiDataFixture Magento/Checkout/_files/enable_all_shipping_methods.php
* @throws \Exception
*/
public function testSetShippingMethodToAnotherCustomerCartAddress()
Expand All @@ -434,7 +427,7 @@ public function testSetShippingMethodToAnotherCustomerCartAddress()
$maskedQuoteId,
'flatrate',
'flatrate',
$quote->getShippingAddress()->getId()
(int)$quote->getShippingAddress()->getId()
);

self::expectExceptionMessage(
Expand All @@ -445,7 +438,6 @@ public function testSetShippingMethodToAnotherCustomerCartAddress()

/**
* @magentoApiDataFixture Magento/Checkout/_files/quote_with_shipping_method.php
* @magentoApiDataFixture Magento/Checkout/_files/enable_all_shipping_methods.php
* @throws \Exception
*/
public function testSetMultipleShippingMethods()
Expand All @@ -456,7 +448,7 @@ public function testSetMultipleShippingMethods()
$quote = $this->quoteFactory->create();
$this->quoteResource->load($quote, 'test_order_1', 'reserved_order_id');

$shippingAddressId = $quote->getShippingAddress()->getId();
$shippingAddressId = (int)$quote->getShippingAddress()->getId();

$mutation = <<<MUTATION
mutation {
Expand Down Expand Up @@ -503,15 +495,15 @@ public function testSetMultipleShippingMethods()
* @param string $maskedQuoteId
* @param string $shippingMethodCode
* @param string $shippingCarrierCode
* @param string $shippingAddressId
* @param int $shippingAddressId
* @return string
* @SuppressWarnings(PHPMD.UnusedPrivateMethod)
*/
private function prepareMutationQuery(
string $maskedQuoteId,
string $shippingMethodCode,
string $shippingCarrierCode,
string $shippingAddressId
int $shippingAddressId
) : string {
return <<<QUERY
mutation {
Expand Down

0 comments on commit 40061f8

Please sign in to comment.