mirror of
https://github.com/wp-graphql/wp-graphql-woocommerce.git
synced 2026-08-14 12:53:44 +02:00
* fix: Product Attribute naming conventions changed * devops: dev dependencies updated * devops: dev dependencies updated * devops: dev dependencies updated * devops: Dockerfile updated * devops: dev dependencies updated * devops: dev dependencies updated * devops: dev dependencies updated * devops: Dockerfile updated * chore: Docker composer configurations updated * chore: Coding standards met.
43 lines
1.0 KiB
PHP
43 lines
1.0 KiB
PHP
<?php
|
|
|
|
class IntrospectionQueryTest extends \Codeception\TestCase\WPTestCase {
|
|
|
|
public function setUp(): void {
|
|
// before
|
|
parent::setUp();
|
|
|
|
$settings = get_option( 'graphql_general_settings' );
|
|
if ( ! $settings ) {
|
|
$settings = array();
|
|
}
|
|
$settings['public_introspection_enabled'] = 'on';
|
|
update_option( 'graphql_general_settings', $settings );
|
|
\WPGraphQL::clear_schema();
|
|
}
|
|
|
|
// Validate schema.
|
|
public function testSchema() {
|
|
try {
|
|
$request = new \WPGraphQL\Request();
|
|
$request->schema->assertValid();
|
|
|
|
// Assert true upon success.
|
|
$this->assertTrue( true );
|
|
} catch ( \GraphQL\Error\InvariantViolation $e ) {
|
|
// use --debug flag to view.
|
|
codecept_debug( $e->getMessage() );
|
|
|
|
// Fail upon throwing
|
|
$this->assertTrue( false );
|
|
}
|
|
}
|
|
|
|
// Test introspection query.
|
|
public function testIntrospectionQuery() {
|
|
$query = \GraphQL\Type\Introspection::getIntrospectionQuery();
|
|
$results = graphql( array( 'query' => $query ) );
|
|
|
|
$this->assertArrayNotHasKey( 'errors', $results );
|
|
}
|
|
}
|