From 81da5de994ed0bcdec993dd2a9caac14b0884bad Mon Sep 17 00:00:00 2001 From: Nadiya Syvokonenko <nsyvokonenko@magento.com> Date: Mon, 11 Jul 2016 15:53:18 +0300 Subject: [PATCH] MAGETWO-50026: [Github] SalesInvoiceRepository attributes not correctly type cast #3605 - add check to API tests --- .../Magento/Sales/Service/V1/CreditmemoGetTest.php | 5 +++++ .../testsuite/Magento/Sales/Service/V1/InvoiceGetTest.php | 5 +++++ .../testsuite/Magento/Sales/Service/V1/OrderGetTest.php | 5 +++++ .../Magento/Sales/Service/V1/OrderItemGetTest.php | 8 ++++++++ 4 files changed, 23 insertions(+) diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoGetTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoGetTest.php index e5a452df8c0..b567d9a5110 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoGetTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoGetTest.php @@ -105,5 +105,10 @@ class CreditmemoGetTest extends WebapiAbstract $this->assertArrayHasKey($field, $actual); $this->assertEquals($expected[$field], $actual[$field]); } + + //check that nullable fields were marked as optional and were not sent + foreach ($actual as $value) { + $this->assertNotNull($value); + } } } diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceGetTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceGetTest.php index 912f222a8e8..030ed01fd1a 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceGetTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceGetTest.php @@ -48,5 +48,10 @@ class InvoiceGetTest extends WebapiAbstract $this->assertArrayHasKey($field, $result); $this->assertEquals($value, $result[$field]); } + + //check that nullable fields were marked as optional and were not sent + foreach ($result as $value) { + $this->assertNotNull($value); + } } } diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderGetTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderGetTest.php index f71b6cbec32..4526e48fdac 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderGetTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderGetTest.php @@ -81,5 +81,10 @@ class OrderGetTest extends WebapiAbstract foreach ($expectedBillingAddressNotEmpty as $field) { $this->assertArrayHasKey($field, $result['billing_address']); } + + //check that nullable fields were marked as optional and were not sent + foreach ($result as $value) { + $this->assertNotNull($value); + } } } diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderItemGetTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderItemGetTest.php index 88a94ca32fc..7831c10ff3a 100644 --- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderItemGetTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderItemGetTest.php @@ -53,6 +53,14 @@ class OrderItemGetTest extends WebapiAbstract $this->assertTrue(is_array($response)); $this->assertOrderItem($orderItem, $response); + + //check that nullable fields were marked as optional and were not sent + foreach ($response as $fieldName => $value) { + if ($fieldName == 'sku') { + continue; + } + $this->assertNotNull($value); + } } /** -- GitLab