|
19 | 19 | use Magento\Review\Test\Fixture\Review as ReviewFixture;
|
20 | 20 | use Magento\Store\Model\StoreManagerInterface;
|
21 | 21 | use Magento\Store\Test\Fixture\Store as StoreFixture;
|
| 22 | +use Magento\Customer\Test\Fixture\Customer as CustomerFixture; |
22 | 23 | use Magento\TestFramework\Fixture\DataFixture;
|
23 | 24 | use Magento\TestFramework\Helper\Bootstrap;
|
24 | 25 | use Magento\TestFramework\ObjectManager;
|
@@ -288,6 +289,57 @@ public function testProductReviewDifferentStores(string $storeCode): void
|
288 | 289 | self::assertCount(1, $response['products']['items'][0]['reviews']['items']);
|
289 | 290 | }
|
290 | 291 |
|
| 292 | + #[ |
| 293 | + DataFixture(StoreFixture::class, ['code' => 'store2'], 'store2'), |
| 294 | + DataFixture(CustomerFixture::class, ['email' => 'customer@example.com'], 'customer'), |
| 295 | + DataFixture(ProductFixture::class, ['sku' => 'product1'], 'product1'), |
| 296 | + DataFixture(ReviewFixture::class, [ |
| 297 | + 'entity_pk_value' => '$product1.id$', |
| 298 | + 'customer_id' => '$customer.entity_id$' |
| 299 | + ]), |
| 300 | + DataFixture(ReviewFixture::class, [ |
| 301 | + 'entity_pk_value' => '$product1.id$', |
| 302 | + 'store_id' => '$store2.id$', |
| 303 | + 'customer_id' => '$customer.entity_id$' |
| 304 | + ]), |
| 305 | + ] |
| 306 | + /** |
| 307 | + * @dataProvider storesDataProvider |
| 308 | + * @param string $storeCode |
| 309 | + */ |
| 310 | + public function testCustomerReviewDifferentStores(string $storeCode): void |
| 311 | + { |
| 312 | + $query = <<<QUERY |
| 313 | +{ |
| 314 | + customer { |
| 315 | + firstname |
| 316 | + lastname |
| 317 | + suffix |
| 318 | + email |
| 319 | + reviews( |
| 320 | + currentPage: 1 |
| 321 | + pageSize: 20 |
| 322 | + ) { |
| 323 | + items { |
| 324 | + summary |
| 325 | + text |
| 326 | + summary |
| 327 | + } |
| 328 | + } |
| 329 | + } |
| 330 | +} |
| 331 | +QUERY; |
| 332 | + $headers = array ('Store' => $storeCode, 'Authorization' => implode($this->getHeaderMap())); |
| 333 | + $response = $this->graphQlQuery($query, [], '', $headers); |
| 334 | + self::assertArrayHasKey('customer', $response); |
| 335 | + self::assertArrayHasKey('reviews', $response['customer']); |
| 336 | + self::assertArrayHasKey('items', $response['customer']['reviews']); |
| 337 | + self::assertNotEmpty($response['customer']['reviews']['items']); |
| 338 | + var_dump($response); |
| 339 | + self::assertCount(1, $response['customer']['reviews']['items']); |
| 340 | + } |
| 341 | + |
| 342 | + |
291 | 343 | /**
|
292 | 344 | * @return array
|
293 | 345 | */
|
|
0 commit comments