|
8 | 8 | namespace Magento\GraphQl\Bundle;
|
9 | 9 |
|
10 | 10 | use Magento\Bundle\Model\Product\OptionList;
|
| 11 | +use Magento\Bundle\Test\Fixture\Option as BundleOptionFixture; |
| 12 | +use Magento\Bundle\Test\Fixture\Product as BundleProductFixture; |
11 | 13 | use Magento\Catalog\Api\Data\ProductInterface;
|
12 | 14 | use Magento\Catalog\Api\ProductRepositoryInterface;
|
| 15 | +use Magento\Catalog\Test\Fixture\Product as ProductFixture; |
13 | 16 | use Magento\Framework\App\Config\ScopeConfigInterface;
|
| 17 | +use Magento\TestFramework\Fixture\DataFixture; |
14 | 18 | use Magento\TestFramework\ObjectManager;
|
15 | 19 | use Magento\TestFramework\TestCase\GraphQlAbstract;
|
16 | 20 | use Magento\Store\Model\StoreManagerInterface;
|
17 | 21 | use Magento\Catalog\Model\Product\Attribute\Source\Status as ProductStatus;
|
| 22 | +use Magento\TestFramework\Fixture\DataFixtureStorage; |
| 23 | +use Magento\TestFramework\Fixture\DataFixtureStorageManager; |
18 | 24 |
|
19 | 25 | /**
|
20 | 26 | * Test querying Bundle products
|
@@ -502,4 +508,69 @@ public function testBundleProductWithDisabledProductOption()
|
502 | 508 | $response = $this->graphQlQuery($query);
|
503 | 509 | $this->assertEmpty($response['products']['items']);
|
504 | 510 | }
|
| 511 | + |
| 512 | + #[ |
| 513 | + DataFixture(ProductFixture::class, ['price' => 10], 'p1'), |
| 514 | + DataFixture(ProductFixture::class, ['price' => 20], 'p2'), |
| 515 | + DataFixture(BundleOptionFixture::class, ['product_links' => ['$p1$']], 'opt1'), |
| 516 | + DataFixture(BundleOptionFixture::class, ['product_links' => ['$p2$']], 'opt2'), |
| 517 | + DataFixture( |
| 518 | + BundleProductFixture::class, |
| 519 | + ['id' => 3, 'sku' => '4bundle-product','_options' => ['$opt1$', '$opt2$']], |
| 520 | + '4bundle-product' |
| 521 | + ), |
| 522 | + DataFixture( |
| 523 | + BundleProductFixture::class, |
| 524 | + ['id' => 4, 'sku' => '5bundle-product','_options' => ['$opt1$', '$opt2$']], |
| 525 | + '5bundle-product' |
| 526 | + ), |
| 527 | + ] |
| 528 | + public function testBundleProductHavingSKUAsNextBundleProductId() |
| 529 | + { |
| 530 | + |
| 531 | + $productSku = '4bundle-product'; |
| 532 | + $query |
| 533 | + = <<<QUERY |
| 534 | +{ |
| 535 | + products(filter: {sku: {eq: "{$productSku}"}}) |
| 536 | + { |
| 537 | + items{ |
| 538 | + id |
| 539 | + type_id |
| 540 | + name |
| 541 | + sku |
| 542 | + ... on BundleProduct { |
| 543 | + items { |
| 544 | + option_id |
| 545 | + title |
| 546 | + required |
| 547 | + type |
| 548 | + position |
| 549 | + sku |
| 550 | + options { |
| 551 | + id |
| 552 | + quantity |
| 553 | + position |
| 554 | + is_default |
| 555 | + price |
| 556 | + price_type |
| 557 | + can_change_quantity |
| 558 | + label |
| 559 | + product { |
| 560 | + id |
| 561 | + name |
| 562 | + sku |
| 563 | + type_id |
| 564 | + } |
| 565 | + } |
| 566 | + } |
| 567 | + } |
| 568 | + } |
| 569 | + } |
| 570 | +} |
| 571 | +QUERY; |
| 572 | + |
| 573 | + $response = $this->graphQlQuery($query); |
| 574 | + $this->assertNotEmpty($response['products']['items']); |
| 575 | + } |
505 | 576 | }
|
0 commit comments