IntrospectionQueryTest.php 998 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\GraphQl;
  8. use Magento\TestFramework\TestCase\GraphQlAbstract;
  9. class IntrospectionQueryTest extends GraphQlAbstract
  10. {
  11. /**
  12. * Tests that Introspection is allowed by default
  13. * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  14. */
  15. public function testIntrospectionQuery()
  16. {
  17. $query
  18. = <<<QUERY
  19. query IntrospectionQuery {
  20. __schema {
  21. queryType { name }
  22. types{
  23. ...FullType
  24. }
  25. }
  26. }
  27. fragment FullType on __Type{
  28. name
  29. kind
  30. fields(includeDeprecated:true){
  31. name
  32. args{
  33. ...InputValue
  34. }
  35. }
  36. }
  37. fragment TypeRef on __Type {
  38. kind
  39. name
  40. ofType{
  41. kind
  42. name
  43. }
  44. }
  45. fragment InputValue on __InputValue {
  46. name
  47. description
  48. type { ...TypeRef }
  49. defaultValue
  50. }
  51. QUERY;
  52. $this->assertArrayHasKey('__schema', $this->graphQlQuery($query));
  53. }
  54. }