mirror of
https://github.com/wp-graphql/wp-graphql-woocommerce.git
synced 2026-08-14 12:53:44 +02:00
* chore: bump min versions to actual and update deps
* chore: fix multiple empty lines at EOF
* chore: preincrement when standalone (phpcs)
* fix: use `printf` instead of `echo sprintf` [phpcs]
* chore: avoid lonely `if()` in `else{}` [phpcs]
* chore: avoid reserved keywords as param names [phpcs]
* chore: remove unused callback params [phpcs]
* chore: remove more unused callback params [phpcs]
* chore: apply lints to tests
* chore: update ruleset for PHPCS 3.0
* texts: restore $last_request_headers
42 lines
1.0 KiB
PHP
42 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 = [];
|
|
}
|
|
$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( [ 'query' => $query ] );
|
|
|
|
$this->assertArrayNotHasKey( 'errors', $results );
|
|
}
|
|
}
|