|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Copyright 2023 Adobe |
| 4 | + * All Rights Reserved. |
| 5 | + * |
| 6 | + * NOTICE: All information contained herein is, and remains |
| 7 | + * the property of Adobe and its suppliers, if any. The intellectual |
| 8 | + * and technical concepts contained herein are proprietary to Adobe |
| 9 | + * and its suppliers and are protected by all applicable intellectual |
| 10 | + * property laws, including trade secret and copyright laws. |
| 11 | + * Dissemination of this information or reproduction of this material |
| 12 | + * is strictly forbidden unless prior written permission is obtained from |
| 13 | + * Adobe. |
| 14 | + */ |
| 15 | +declare(strict_types=1); |
| 16 | + |
| 17 | +namespace Magento\GraphQl\Quote; |
| 18 | + |
| 19 | +use Magento\Framework\DataObject; |
| 20 | +use Magento\TestFramework\Fixture\Config; |
| 21 | +use Magento\TestFramework\TestCase\GraphQlAbstract; |
| 22 | + |
| 23 | +/** |
| 24 | + * Test for getting max_items_in_order_summary from storeConfig query |
| 25 | + */ |
| 26 | +class GetMaxItemsInOrderSummaryTest extends GraphQlAbstract |
| 27 | +{ |
| 28 | + private const MAX_ITEMS_TO_DISPLAY = 5; |
| 29 | + |
| 30 | + #[ |
| 31 | + Config('checkout/options/max_items_display_count', self::MAX_ITEMS_TO_DISPLAY) |
| 32 | + ] |
| 33 | + public function testGetMaxItemsInOrderSummary() |
| 34 | + { |
| 35 | + $query = $this->getQuery(); |
| 36 | + $response = $this->graphQlMutation($query); |
| 37 | + $responseDataObject = new DataObject($response); |
| 38 | + |
| 39 | + self::assertEquals(self::MAX_ITEMS_TO_DISPLAY, $responseDataObject->getData('storeConfig/max_items_in_order_summary')); |
| 40 | + } |
| 41 | + |
| 42 | + /** |
| 43 | + * Create storeConfig query |
| 44 | + * |
| 45 | + * @return string |
| 46 | + */ |
| 47 | + private function getQuery(): string |
| 48 | + { |
| 49 | + return <<<QUERY |
| 50 | +{ |
| 51 | + storeConfig { |
| 52 | + max_items_in_order_summary |
| 53 | + } |
| 54 | +} |
| 55 | +QUERY; |
| 56 | + } |
| 57 | +} |
0 commit comments