From b98b1ae6ac6a17eef080f176fa560dc38a613215 Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Fri, 19 Jun 2020 18:44:21 -0400 Subject: [PATCH] Some unit tests updated. --- tests/wpunit/IntrospectionQueryTest.php | 96 +------------------------ tests/wpunit/ProductQueriesTest.php | 2 +- 2 files changed, 4 insertions(+), 94 deletions(-) diff --git a/tests/wpunit/IntrospectionQueryTest.php b/tests/wpunit/IntrospectionQueryTest.php index 484af6c5..c874324b 100644 --- a/tests/wpunit/IntrospectionQueryTest.php +++ b/tests/wpunit/IntrospectionQueryTest.php @@ -28,7 +28,7 @@ class IntrospectionQueryTest extends \Codeception\TestCase\WPTestCase } catch (\GraphQL\Error\InvariantViolation $e) { // use --debug flag to view. codecept_debug( $e->getMessage() ); - + // Fail upon throwing $this->assertTrue( false ); } @@ -36,99 +36,9 @@ class IntrospectionQueryTest extends \Codeception\TestCase\WPTestCase // Test introspection query. public function testIntrospectionQuery() { - $query = ' - query IntrospectionQuery { - __schema { - queryType { name } - mutationType { name } - subscriptionType { name } - types { - ...FullType - } - directives { - name - description - locations - args { - ...InputValue - } - } - } - } - fragment FullType on __Type { - kind - name - description - fields(includeDeprecated: true) { - name - description - args { - ...InputValue - } - type { - ...TypeRef - } - isDeprecated - deprecationReason - } - inputFields { - ...InputValue - } - interfaces { - ...TypeRef - } - enumValues(includeDeprecated: true) { - name - description - isDeprecated - deprecationReason - } - possibleTypes { - ...TypeRef - } - } - fragment InputValue on __InputValue { - name - description - type { ...TypeRef } - defaultValue - } - fragment TypeRef on __Type { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - ofType { - kind - name - } - } - } - } - } - } - } - } - '; - + $query = \GraphQL\Type\Introspection::getIntrospectionQuery(); $results = graphql( array( 'query' => $query ) ); $this->assertArrayNotHasKey('errors', $results ); } -} \ No newline at end of file +} diff --git a/tests/wpunit/ProductQueriesTest.php b/tests/wpunit/ProductQueriesTest.php index 8024d957..f51fe410 100644 --- a/tests/wpunit/ProductQueriesTest.php +++ b/tests/wpunit/ProductQueriesTest.php @@ -175,7 +175,7 @@ class ProductQueriesTest extends \Codeception\TestCase\WPTestCase { array( 'price' => 10, 'regular_price' => 10, - 'category_ids' => array( $category_5, $category_6 ), + 'category_ids' => array( $category_5 ), 'tag_ids' => array( $tag_2 ), 'image_id' => $attachment_id, )