From 14c4bd210beb4a68d8d43745565b9fa0d03148e5 Mon Sep 17 00:00:00 2001 From: Benedikt Franke Date: Wed, 13 Nov 2024 10:03:44 +0100 Subject: [PATCH] Fix test --- src/Type/Definition/Type.php | 1 - tests/Type/StandardTypesTest.php | 11 ++++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Type/Definition/Type.php b/src/Type/Definition/Type.php index 5aa0a817b..7893847aa 100644 --- a/src/Type/Definition/Type.php +++ b/src/Type/Definition/Type.php @@ -267,7 +267,6 @@ public function jsonSerialize(): string public static function reset(): void { - static::$standardTypes = null; static::$builtInTypes = null; Introspection::reset(); diff --git a/tests/Type/StandardTypesTest.php b/tests/Type/StandardTypesTest.php index 282cf3600..3d9e899e6 100644 --- a/tests/Type/StandardTypesTest.php +++ b/tests/Type/StandardTypesTest.php @@ -6,16 +6,25 @@ use GraphQL\Type\Definition\CustomScalarType; use GraphQL\Type\Definition\Directive; use GraphQL\Type\Definition\ObjectType; +use GraphQL\Type\Definition\ScalarType; use GraphQL\Type\Definition\Type; use GraphQL\Type\Introspection; use PHPUnit\Framework\TestCase; final class StandardTypesTest extends TestCase { + /** @var array */ + private static array $originalStandardTypes; + + public static function setUpBeforeClass(): void + { + self::$originalStandardTypes = Type::getStandardTypes(); + } + public function tearDown(): void { parent::tearDown(); - Type::reset(); + Type::overrideStandardTypes(self::$originalStandardTypes); } public function testAllowsOverridingStandardTypes(): void