From 7f6b8e0172623d94cdbf5265e8ee056b422a46e3 Mon Sep 17 00:00:00 2001 From: Brown Date: Sun, 26 Jul 2020 10:12:53 -0400 Subject: [PATCH] Consolidate internal annotation tests --- tests/InternalAnnotationTest.php | 549 ++++++++++++++++++++++++ tests/PsalmInternalAnnotationTest.php | 575 -------------------------- 2 files changed, 549 insertions(+), 575 deletions(-) delete mode 100644 tests/PsalmInternalAnnotationTest.php diff --git a/tests/InternalAnnotationTest.php b/tests/InternalAnnotationTest.php index fc9f0c9ef..d8441cf2e 100644 --- a/tests/InternalAnnotationTest.php +++ b/tests/InternalAnnotationTest.php @@ -257,6 +257,282 @@ class InternalAnnotationTest extends TestCase } }', ], + 'psalmInternalMethodWithCall' => [ + ' [ + ' [ + ' [ + ' [ + 'barBar(); + } + } + }', + ], + 'psalmInternalClassWithPropertyFetch' => [ + 'barBar; + } + } + }', + ], + 'psalmInternalClassExtendingNamespaceWithStaticCall' => [ + ' [ + ' [ + ' [ + ' [ + 'foo; + } + } + }', + ], + 'psalmInternalPropertySet' => [ + 'foo = 5; + } + } + }', + ], + 'psalmInternalMethodInTraitWithCall' => [ + ' 'InternalClass', ], + 'psalmInternalMethodWithCall' => [ + ' 'The method A\B\Foo::barBar is internal to A\B', + ], + 'psalmInternalToClassMethodWithCall' => [ + ' 'The method A\B\Foo::barBar is internal to A\B\Foo', + ], + 'psalmInternalClassWithStaticCall' => [ + ' 'InternalClass', + ], + 'psalmInternalClassWithPropertyFetch' => [ + 'barBar; + } + } + }', + 'error_message' => 'A\B\Foo::$barBar is internal to A\B', + ], + 'psalmInternalClassWithInstanceCall' => [ + 'barBar(); + } + } + }', + 'error_message' => 'The method A\B\Foo::barBar is internal to A\B', + ], + 'psalmInternalClassWithNew' => [ + ' 'InternalClass', + ], + 'psalmInternalClassWithExtends' => [ + ' 'A\B\Foo is internal to A\B', + ], + 'psalmInternalPropertyGet' => [ + 'foo; + } + } + }', + 'error_message' => 'A\B\Foo::$foo is internal to A\B', + ], + 'psalmInternalPropertySet' => [ + 'foo = 5; + } + } + }', + 'error_message' => 'A\B\Foo::$foo is internal to A\B', + ], + 'psalmInternalClassMissingNamespace' => [ + ' 'psalm-internal annotation used without specifying namespace', + ], + 'psalmInternalPropertyMissingNamespace' => [ + ' 'psalm-internal annotation used without specifying namespace', + ], + 'psalmInternalMethodMissingNamespace' => [ + ' 'psalm-internal annotation used without specifying namespace', + ], + 'psalmInternalClassMissingInternalAnnotation' => [ + ' 'psalm-internal annotation used without @internal', + ], + 'psalmInternalPropertyMissingInternalAnnotation' => [ + ' 'psalm-internal annotation used without @internal', + ], + 'psalmInternalFunctionMissingInternalAnnotation' => [ + ' 'psalm-internal annotation used without @internal', + ], ]; } } diff --git a/tests/PsalmInternalAnnotationTest.php b/tests/PsalmInternalAnnotationTest.php deleted file mode 100644 index 011258189..000000000 --- a/tests/PsalmInternalAnnotationTest.php +++ /dev/null @@ -1,575 +0,0 @@ -,error_levels?:string[]}> - */ - public function providerValidCodeParse() - { - return [ - 'internalMethodWithCall' => [ - ' [ - ' [ - ' [ - ' [ - 'barBar(); - } - } - }', - ], - 'internalClassWithPropertyFetch' => [ - 'barBar; - } - } - }', - ], - 'internalClassExtendingNamespaceWithStaticCall' => [ - ' [ - ' [ - ' [ - ' [ - 'foo; - } - } - }', - ], - 'internalPropertySet' => [ - 'foo = 5; - } - } - }', - ], - 'internalMethodInTraitWithCall' => [ - ' - */ - public function providerInvalidCodeParse() - { - return [ - 'internalMethodWithCall' => [ - ' 'The method A\B\Foo::barBar is internal to A\B', - ], - 'internalToClassMethodWithCall' => [ - ' 'The method A\B\Foo::barBar is internal to A\B\Foo', - ], - 'internalClassWithStaticCall' => [ - ' 'InternalClass', - ], - 'internalClassWithPropertyFetch' => [ - 'barBar; - } - } - }', - 'error_message' => 'A\B\Foo::$barBar is internal to A\B', - ], - 'internalClassWithInstanceCall' => [ - 'barBar(); - } - } - }', - 'error_message' => 'The method A\B\Foo::barBar is internal to A\B', - ], - 'internalClassWithNew' => [ - ' 'InternalClass', - ], - 'internalClassWithExtends' => [ - ' 'A\B\Foo is internal to A\B', - ], - 'internalPropertyGet' => [ - 'foo; - } - } - }', - 'error_message' => 'A\B\Foo::$foo is internal to A\B', - ], - 'internalPropertySet' => [ - 'foo = 5; - } - } - }', - 'error_message' => 'A\B\Foo::$foo is internal to A\B', - ], - 'internalClassMissingNamespace' => [ - ' 'psalm-internal annotation used without specifying namespace', - ], - 'internalPropertyMissingNamespace' => [ - ' 'psalm-internal annotation used without specifying namespace', - ], - 'internalMethodMissingNamespace' => [ - ' 'psalm-internal annotation used without specifying namespace', - ], - 'internalClassMissingInternalAnnotation' => [ - ' 'psalm-internal annotation used without @internal', - ], - 'internalPropertyMissingInternalAnnotation' => [ - ' 'psalm-internal annotation used without @internal', - ], - 'internalFunctionMissingInternalAnnotation' => [ - ' 'psalm-internal annotation used without @internal', - ], - ]; - } -}