|
| 1 | +<?php |
| 2 | +/************************************************************************ |
| 3 | + * |
| 4 | + * Copyright 2023 Adobe |
| 5 | + * All Rights Reserved. |
| 6 | + * |
| 7 | + * NOTICE: All information contained herein is, and remains |
| 8 | + * the property of Adobe and its suppliers, if any. The intellectual |
| 9 | + * and technical concepts contained herein are proprietary to Adobe |
| 10 | + * and its suppliers and are protected by all applicable intellectual |
| 11 | + * property laws, including trade secret and copyright laws. |
| 12 | + * Dissemination of this information or reproduction of this material |
| 13 | + * is strictly forbidden unless prior written permission is obtained |
| 14 | + * from Adobe. |
| 15 | + * ************************************************************************ |
| 16 | + */ |
| 17 | +declare(strict_types=1); |
| 18 | + |
| 19 | +namespace Magento\GraphQl\GraphQlCache; |
| 20 | + |
| 21 | +use Magento\Customer\Test\Fixture\Customer; |
| 22 | +use Magento\TestFramework\Fixture\DataFixture; |
| 23 | +use Magento\TestFramework\Fixture\DataFixtureStorageManager; |
| 24 | +use Magento\TestFramework\TestCase\GraphQlAbstract; |
| 25 | + |
| 26 | +class GraphQlTest extends GraphQlAbstract |
| 27 | +{ |
| 28 | + #[ |
| 29 | + DataFixture(Customer::class, as: 'customer'), |
| 30 | + ] |
| 31 | + public function testMutation(): void |
| 32 | + { |
| 33 | + /** @var \Magento\Customer\Model\Customer $customer */ |
| 34 | + $customer = DataFixtureStorageManager::getStorage()->get('customer'); |
| 35 | + $generateToken = <<<MUTATION |
| 36 | + mutation{ |
| 37 | + generateCustomerToken |
| 38 | + ( |
| 39 | + email:"{$customer->getEmail()}", |
| 40 | + password: "password" |
| 41 | + ) |
| 42 | + { |
| 43 | + token |
| 44 | + } |
| 45 | + } |
| 46 | +MUTATION; |
| 47 | + $tokenResponse = $this->graphQlMutationWithResponseHeaders($generateToken); |
| 48 | + $this->assertEquals('no-cache', $tokenResponse['headers']['Pragma']); |
| 49 | + $this->assertEquals( |
| 50 | + 'max-age=0, must-revalidate, no-cache, no-store', |
| 51 | + $tokenResponse['headers']['Cache-Control'] |
| 52 | + ); |
| 53 | + } |
| 54 | +} |
0 commit comments