From 19054ebc0b359da7b8c19439d7a0a92f1ae0b02c Mon Sep 17 00:00:00 2001 From: Yurii Kuvshynov <141632421+fogrye@users.noreply.github.com> Date: Thu, 14 Mar 2024 21:00:44 +0100 Subject: [PATCH] test: check that incorrect classes don't trigger autoloading errors Thanks @oprypkhantc --- .../BadNamespace/BadlyNamespacedClass.php | 8 +++ .../BadNamespace/ClassWithoutNamespace.php | 5 ++ tests/Utils/NsTest.php | 56 +++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 tests/Fixtures/BadNamespace/BadlyNamespacedClass.php create mode 100644 tests/Fixtures/BadNamespace/ClassWithoutNamespace.php create mode 100644 tests/Utils/NsTest.php diff --git a/tests/Fixtures/BadNamespace/BadlyNamespacedClass.php b/tests/Fixtures/BadNamespace/BadlyNamespacedClass.php new file mode 100644 index 0000000000..258dac6fd5 --- /dev/null +++ b/tests/Fixtures/BadNamespace/BadlyNamespacedClass.php @@ -0,0 +1,8 @@ +getClassList())); + } + + public static function loadsClassListProvider(): iterable + { + yield 'autoload' => [ + [ + TestFactory::class, + GetterSetterType::class, + FooType::class, + MagicGetterSetterType::class, + FooExtendType::class, + NoTypeAnnotation::class, + AbstractFooType::class, + ], + 'TheCodingMachine\GraphQLite\Fixtures\Types', + ]; + + // The class should be ignored. + yield 'incorrect namespace class without autoload' => [ + [], + 'TheCodingMachine\GraphQLite\Fixtures\BadNamespace', + ]; + } +} \ No newline at end of file