Skip to content

Commit 62aabd7

Browse files
committed
ACP2E-894: added parametrized data fixtures
1 parent 2d57fae commit 62aabd7

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

app/code/Magento/Store/Test/Fixture/Store.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function apply(array $data = []): ?DataObject
9393
$store->setData($this->prepareData($data));
9494
$this->storeResource->save($store);
9595
$this->storeManager->reinitStores();
96-
$this->regenerateSequenceTables($store->getId());
96+
$this->regenerateSequenceTables((int)$store->getId());
9797
return $store;
9898
}
9999

@@ -136,6 +136,8 @@ private function prepareData(array $data): array
136136
}
137137

138138
/**
139+
* Generate missing sequence tables
140+
*
139141
* @param int $storeId
140142
*
141143
* @return void

dev/tests/api-functional/testsuite/Magento/GraphQl/Sales/CustomerOrders/GetCustomerOrdersTest.php

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Magento\Customer\Model\CustomerAuthUpdate;
1919
use Magento\Customer\Model\CustomerRegistry;
2020
use Magento\Customer\Test\Fixture\Customer;
21+
use Magento\Framework\Exception\LocalizedException;
2122
use Magento\Framework\ObjectManagerInterface;
2223
use Magento\Integration\Api\CustomerTokenServiceInterface;
2324
use Magento\Quote\Test\Fixture\AddProductToCart;
@@ -76,6 +77,11 @@ protected function setUp(): void
7677
$this->customerRepository = $this->objectManager->get(CustomerRepositoryInterface::class);
7778
}
7879

80+
/**
81+
* Test graphql customer orders
82+
*
83+
* @throws LocalizedException
84+
*/
7985
#[
8086
Config(Data::XML_PATH_PRICE_SCOPE, Data::PRICE_SCOPE_WEBSITE),
8187
DataFixture(WebsiteFixture::class, as: 'website2'),
@@ -146,7 +152,7 @@ public function testGetCustomerOrders()
146152
$this->getCustomerHeaders($customerToken, $store2->getCode())
147153
);
148154

149-
$this->assertNotNull($response['customer']['orders']);
155+
$this->assertEquals(2, count($response['customer']['orders']['items']));
150156

151157
$response = $this->graphQlQuery(
152158
$query,
@@ -155,7 +161,27 @@ public function testGetCustomerOrders()
155161
$this->getCustomerHeaders($customerToken, $store3->getCode())
156162
);
157163

158-
$this->assertNotNull($response['customer']['orders']);
164+
$this->assertEquals(2, count($response['customer']['orders']['items']));
165+
166+
$query = $this->getCustomerOrdersQuery('WEBSITE');
167+
$response = $this->graphQlQuery(
168+
$query,
169+
[],
170+
'',
171+
$this->getCustomerHeaders($customerToken, $store2->getCode())
172+
);
173+
174+
$this->assertEquals(2, count($response['customer']['orders']['items']));
175+
176+
$query = $this->getCustomerOrdersQuery('GLOBAL');
177+
$response = $this->graphQlQuery(
178+
$query,
179+
[],
180+
'',
181+
$this->getCustomerHeaders($customerToken, null)
182+
);
183+
184+
$this->assertEquals(2, count($response['customer']['orders']['items']));
159185

160186
$query = $this->getCustomerOrdersQuery();
161187
$response = $this->graphQlQuery(
@@ -165,10 +191,12 @@ public function testGetCustomerOrders()
165191
$this->getCustomerHeaders($customerToken, null)
166192
);
167193

168-
$this->assertNotNull($response['customer']['orders']);
194+
$this->assertEquals(0, count($response['customer']['orders']['items']));
169195
}
170196

171197
/**
198+
* Generate graphql query headers for customer orders
199+
*
172200
* @param string $token
173201
* @param string|null $storeCode
174202
*
@@ -180,6 +208,8 @@ private function getCustomerHeaders(string $token, ?string $storeCode): array
180208
}
181209

182210
/**
211+
* Generate graphql query body for customer orders
212+
*
183213
* @param string|null $scope
184214
*
185215
* @return array|string
@@ -211,6 +241,8 @@ private function getCustomerOrdersQuery(?string $scope = null): array|string
211241
}
212242

213243
/**
244+
* Get customer login token
245+
*
214246
* @param string $email
215247
* @param string $password
216248
* @return string

0 commit comments

Comments
 (0)