|
1 | 1 | <?php
|
2 | 2 | /**
|
3 |
| - * Copyright © Magento, Inc. All rights reserved. |
4 |
| - * See COPYING.txt for license details. |
| 3 | + * Copyright 2025 Adobe |
| 4 | + * All Rights Reserved. |
5 | 5 | */
|
6 | 6 | declare(strict_types=1);
|
7 | 7 |
|
@@ -41,47 +41,52 @@ class StoreConfigResolverTest extends GraphQlAbstract
|
41 | 41 | 'default'
|
42 | 42 | ),
|
43 | 43 | ConfigFixture('checkout/cart/grouped_product_image', 'parent', ScopeInterface::SCOPE_STORE, 'default'),
|
44 |
| - ConfigFixture('checkout/cart/configurable_product_image', 'itself', ScopeInterface::SCOPE_STORE, 'default') |
| 44 | + ConfigFixture('checkout/cart/configurable_product_image', 'itself', ScopeInterface::SCOPE_STORE, 'default'), |
| 45 | + ConfigFixture('checkout/options/enable_agreements', true, ScopeInterface::SCOPE_STORE, 'default') |
45 | 46 | ]
|
46 | 47 | public function testGetStoreConfig(): void
|
47 | 48 | {
|
48 |
| - $query |
49 |
| - = <<<QUERY |
50 |
| -{ |
51 |
| - storeConfig { |
52 |
| - is_guest_checkout_enabled, |
53 |
| - is_one_page_checkout_enabled, |
54 |
| - max_items_in_order_summary, |
55 |
| - cart_summary_display_quantity, |
56 |
| - minicart_display, |
57 |
| - minicart_max_items, |
58 |
| - cart_expires_in_days, |
59 |
| - grouped_product_image, |
60 |
| - configurable_product_image |
61 |
| - } |
62 |
| -} |
63 |
| -QUERY; |
64 |
| - $response = $this->graphQlQuery($query); |
65 |
| - $this->assertArrayHasKey('storeConfig', $response); |
66 |
| - $this->validateStoreConfig($response['storeConfig']); |
| 49 | + $this->assertEquals( |
| 50 | + [ |
| 51 | + 'storeConfig' => [ |
| 52 | + 'is_guest_checkout_enabled' => true, |
| 53 | + 'is_one_page_checkout_enabled' => true, |
| 54 | + 'max_items_in_order_summary' => self::MAX_ITEMS_TO_DISPLAY, |
| 55 | + 'cart_summary_display_quantity' => self::CART_SUMMARY_DISPLAY_TOTAL, |
| 56 | + 'minicart_display' => true, |
| 57 | + 'minicart_max_items' => self::MINICART_MAX_ITEMS, |
| 58 | + 'cart_expires_in_days' => self::CART_EXPIRES_IN_DAYS, |
| 59 | + 'grouped_product_image' => 'PARENT', |
| 60 | + 'configurable_product_image' => 'ITSELF', |
| 61 | + 'is_checkout_agreements_enabled' => true, |
| 62 | + ], |
| 63 | + ], |
| 64 | + $this->graphQlQuery($this->getStoreConfigQuery()) |
| 65 | + ); |
67 | 66 | }
|
68 | 67 |
|
69 | 68 | /**
|
70 |
| - * Validate Store Config Data |
| 69 | + * Generates storeConfig query |
71 | 70 | *
|
72 |
| - * @param array $responseConfig |
| 71 | + * @return string |
73 | 72 | */
|
74 |
| - private function validateStoreConfig( |
75 |
| - array $responseConfig, |
76 |
| - ): void { |
77 |
| - $this->assertTrue($responseConfig['is_guest_checkout_enabled']); |
78 |
| - $this->assertTrue($responseConfig['is_one_page_checkout_enabled']); |
79 |
| - $this->assertEquals(self::MAX_ITEMS_TO_DISPLAY, $responseConfig['max_items_in_order_summary']); |
80 |
| - $this->assertEquals(self::CART_SUMMARY_DISPLAY_TOTAL, $responseConfig['cart_summary_display_quantity']); |
81 |
| - $this->assertTrue($responseConfig['minicart_display']); |
82 |
| - $this->assertEquals(self::MINICART_MAX_ITEMS, $responseConfig['minicart_max_items']); |
83 |
| - $this->assertEquals(self::CART_EXPIRES_IN_DAYS, $responseConfig['cart_expires_in_days']); |
84 |
| - $this->assertEquals('PARENT', $responseConfig['grouped_product_image']); |
85 |
| - $this->assertEquals('ITSELF', $responseConfig['configurable_product_image']); |
| 73 | + private function getStoreConfigQuery(): string |
| 74 | + { |
| 75 | + return <<<QUERY |
| 76 | + { |
| 77 | + storeConfig { |
| 78 | + is_guest_checkout_enabled |
| 79 | + is_one_page_checkout_enabled |
| 80 | + max_items_in_order_summary |
| 81 | + cart_summary_display_quantity |
| 82 | + minicart_display |
| 83 | + minicart_max_items |
| 84 | + cart_expires_in_days |
| 85 | + grouped_product_image |
| 86 | + configurable_product_image |
| 87 | + is_checkout_agreements_enabled |
| 88 | + } |
| 89 | + } |
| 90 | + QUERY; |
86 | 91 | }
|
87 | 92 | }
|
0 commit comments