From ce548deb9d4e24b21bdc23171f2f4da347df6ed6 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Mon, 1 May 2017 21:32:01 -0700 Subject: [PATCH] Update baselines - failing tests are verified as expected --- tests/Validation/ValidationTest.php | 19 +++++++++++-------- .../WithReturnTypehints.php.expected.json | 4 ++-- .../broken/constants5.php.expected.json | 5 +---- .../broken/functionUse2.php.expected.json | 2 +- .../broken/memberAccess3.php.expected.json | 4 ++-- .../multipleNamespaces.php.expected.json | 6 ++++++ ...ltiplePreceedingComments.php.expected.json | 4 ++-- .../broken/nameToken.php.expected.json | 6 +----- .../broken/parent3.php.expected.json | 8 +------- .../scopedPropertyAccess3.php.expected.json | 4 ++-- .../scopedPropertyAccess5.php.expected.json | 4 ++-- .../frameworks/broken/self2.php.expected.json | 4 ++-- .../frameworks/broken/self3.php.expected.json | 8 +------- .../broken/static2.php.expected.json | 4 ++-- .../broken/stringVariable.php.expected.json | 6 +----- ...edNameOutsideOfNamespace.php.expected.json | 3 --- ...rifyFqsenOnClassProperty.php.expected.json | 2 +- 17 files changed, 38 insertions(+), 55 deletions(-) diff --git a/tests/Validation/ValidationTest.php b/tests/Validation/ValidationTest.php index 9f292d6..5a31eec 100644 --- a/tests/Validation/ValidationTest.php +++ b/tests/Validation/ValidationTest.php @@ -61,7 +61,7 @@ class ValidationTest extends TestCase $fileContents = file_get_contents($testCaseFile); $expectedValues = $this->getExpectedTestValues($testCaseFile, $frameworkName, $fileContents); - $actualValues = $this->getActualTestValues($testCaseFile, $fileContents); + $actualValues = $this->getActualTestValues($testCaseFile, $frameworkName, $fileContents); $this->assertEquals($expectedValues['definitions'], $actualValues['definitions']); @@ -111,14 +111,10 @@ class ValidationTest extends TestCase 'definitions' => json_decode(json_encode($expectedDefs)) ); - if ($frameworkName === 'broken') { - file_put_contents($outputFile, json_encode($refsAndDefs, JSON_PRETTY_PRINT)); - } - return $refsAndDefs; } - private function getActualTestValues($filename, $fileContents): array { + private function getActualTestValues($filename, $frameworkName, $fileContents): array { global $parserKind; $parserKind = ParserKind::TOLERANT_PHP_PARSER; @@ -133,12 +129,19 @@ class ValidationTest extends TestCase $this->filterSkippedReferences($actualRefs); $actualDefs = $this->getTestValuesFromDefs($document->getDefinitions()); - // TODO - probably a more PHP-typical way to do this. Need to compare the objects parsed from json files + // TODO - there's probably a more PHP-typical way to do this. Need to compare the objects parsed from json files // to the real results. json_decode returns stdClass Objects, not arrays. - return array( + $refsAndDefs = array( 'references' => json_decode(json_encode($actualRefs)), 'definitions' => json_decode(json_encode($actualDefs)) ); + + $outputFile = $filename . '.expected.json'; + if ($frameworkName === 'broken') { + file_put_contents($outputFile, json_encode($refsAndDefs, JSON_PRETTY_PRINT)); + } + + return $refsAndDefs; } /** diff --git a/validation/frameworks/broken/WithReturnTypehints.php.expected.json b/validation/frameworks/broken/WithReturnTypehints.php.expected.json index f9c2430..0a3eb09 100644 --- a/validation/frameworks/broken/WithReturnTypehints.php.expected.json +++ b/validation/frameworks/broken/WithReturnTypehints.php.expected.json @@ -60,7 +60,7 @@ }, "containerName": "Fixtures\\Prophecy\\WithReturnTypehints" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__class": "phpDocumentor\\Reflection\\Types\\Object_", "type": {}, "documentation": null }, @@ -94,7 +94,7 @@ }, "containerName": "Fixtures\\Prophecy\\WithReturnTypehints" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__class": "phpDocumentor\\Reflection\\Types\\Object_", "type": {}, "documentation": null } diff --git a/validation/frameworks/broken/constants5.php.expected.json b/validation/frameworks/broken/constants5.php.expected.json index 189b1cb..3d5da35 100644 --- a/validation/frameworks/broken/constants5.php.expected.json +++ b/validation/frameworks/broken/constants5.php.expected.json @@ -2,9 +2,6 @@ "references": { "MyNamespace\\PHP_INT_MAX": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/constants5.php" - ], - "PHP_INT_MAX": [ - "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/constants5.php" ] }, "definitions": { @@ -55,7 +52,7 @@ }, "containerName": "MyNamespace\\Mbstring" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__class": "phpDocumentor\\Reflection\\Types\\Object_", "type": {}, "documentation": null } diff --git a/validation/frameworks/broken/functionUse2.php.expected.json b/validation/frameworks/broken/functionUse2.php.expected.json index dfb66d5..fa047e6 100644 --- a/validation/frameworks/broken/functionUse2.php.expected.json +++ b/validation/frameworks/broken/functionUse2.php.expected.json @@ -3,7 +3,7 @@ "LanguageServer": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/functionUse2.php" ], - "LanguageServer\\timeout": [ + "LanguageServer\\timeout()": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/functionUse2.php" ] }, diff --git a/validation/frameworks/broken/memberAccess3.php.expected.json b/validation/frameworks/broken/memberAccess3.php.expected.json index 9026d38..c9e8310 100644 --- a/validation/frameworks/broken/memberAccess3.php.expected.json +++ b/validation/frameworks/broken/memberAccess3.php.expected.json @@ -12,10 +12,10 @@ "MyNamespace\\ClassLoader->prefixesPsr0": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/memberAccess3.php" ], - "MyNamespace\\ComposerStaticInitIncludePath::$prefixesPsr0": [ + "MyNamespace\\ComposerStaticInitIncludePath": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/memberAccess3.php" ], - "MyNamespace\\ComposerStaticInitIncludePath": [ + "MyNamespace\\ComposerStaticInitIncludePath::$prefixesPsr0": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/memberAccess3.php" ], "MyNamespace\\ClassLoader::class": [ diff --git a/validation/frameworks/broken/multipleNamespaces.php.expected.json b/validation/frameworks/broken/multipleNamespaces.php.expected.json index 95b3645..274dd5b 100644 --- a/validation/frameworks/broken/multipleNamespaces.php.expected.json +++ b/validation/frameworks/broken/multipleNamespaces.php.expected.json @@ -3,6 +3,12 @@ "MyNamespace2\\MyNamespace1\\B": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/multipleNamespaces.php" ], + "MyNamespace2\\MyNamespace1": [ + "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/multipleNamespaces.php" + ], + "MyNamespace2": [ + "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/multipleNamespaces.php" + ], "MyNamespace2\\A->b()": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/multipleNamespaces.php" ] diff --git a/validation/frameworks/broken/multiplePreceedingComments.php.expected.json b/validation/frameworks/broken/multiplePreceedingComments.php.expected.json index 3feefc4..415b052 100644 --- a/validation/frameworks/broken/multiplePreceedingComments.php.expected.json +++ b/validation/frameworks/broken/multiplePreceedingComments.php.expected.json @@ -31,9 +31,9 @@ }, "containerName": "Foo" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__class": "phpDocumentor\\Reflection\\Types\\Object_", "type": {}, - "documentation": null + "documentation": "Foo" } } } \ No newline at end of file diff --git a/validation/frameworks/broken/nameToken.php.expected.json b/validation/frameworks/broken/nameToken.php.expected.json index 12bb667..5513701 100644 --- a/validation/frameworks/broken/nameToken.php.expected.json +++ b/validation/frameworks/broken/nameToken.php.expected.json @@ -1,9 +1,5 @@ { - "references": { - "static": [ - "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/nameToken.php" - ] - }, + "references": [], "definitions": { "A": { "extends": [], diff --git a/validation/frameworks/broken/parent3.php.expected.json b/validation/frameworks/broken/parent3.php.expected.json index b051fb9..1acf7ab 100644 --- a/validation/frameworks/broken/parent3.php.expected.json +++ b/validation/frameworks/broken/parent3.php.expected.json @@ -3,17 +3,11 @@ "MyNamespace\\B": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/parent3.php" ], - "MyNamespace\\parent": [ + "MyNamespace\\B->b()": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/parent3.php" ], "parent": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/parent3.php" - ], - "MyNamespace\\b()": [ - "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/parent3.php" - ], - "b()": [ - "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/parent3.php" ] }, "definitions": { diff --git a/validation/frameworks/broken/scopedPropertyAccess3.php.expected.json b/validation/frameworks/broken/scopedPropertyAccess3.php.expected.json index 7017098..d64eb89 100644 --- a/validation/frameworks/broken/scopedPropertyAccess3.php.expected.json +++ b/validation/frameworks/broken/scopedPropertyAccess3.php.expected.json @@ -1,9 +1,9 @@ { "references": { - "A::$a": [ + "A": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/scopedPropertyAccess3.php" ], - "A": [ + "A::$a": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/scopedPropertyAccess3.php" ] }, diff --git a/validation/frameworks/broken/scopedPropertyAccess5.php.expected.json b/validation/frameworks/broken/scopedPropertyAccess5.php.expected.json index a556e1a..84d52c3 100644 --- a/validation/frameworks/broken/scopedPropertyAccess5.php.expected.json +++ b/validation/frameworks/broken/scopedPropertyAccess5.php.expected.json @@ -3,10 +3,10 @@ "TestInterface": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/scopedPropertyAccess5.php" ], - "TestClass::$testProperty": [ + "TestClass": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/scopedPropertyAccess5.php" ], - "TestClass": [ + "TestClass::$testProperty": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/scopedPropertyAccess5.php" ], "TestClass::$staticTestProperty": [ diff --git a/validation/frameworks/broken/self2.php.expected.json b/validation/frameworks/broken/self2.php.expected.json index 71204d8..03b72d6 100644 --- a/validation/frameworks/broken/self2.php.expected.json +++ b/validation/frameworks/broken/self2.php.expected.json @@ -3,10 +3,10 @@ "MyNamespace\\B": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/self2.php" ], - "SELF::b()": [ + "MyNamespace\\A::b()": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/self2.php" ], - "SELF": [ + "self": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/self2.php" ] }, diff --git a/validation/frameworks/broken/self3.php.expected.json b/validation/frameworks/broken/self3.php.expected.json index 0bf7e6c..e2ea5f2 100644 --- a/validation/frameworks/broken/self3.php.expected.json +++ b/validation/frameworks/broken/self3.php.expected.json @@ -3,17 +3,11 @@ "MyNamespace\\B": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/self3.php" ], - "MyNamespace\\self": [ + "MyNamespace\\A->b()": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/self3.php" ], "self": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/self3.php" - ], - "MyNamespace\\b()": [ - "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/self3.php" - ], - "b()": [ - "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/self3.php" ] }, "definitions": { diff --git a/validation/frameworks/broken/static2.php.expected.json b/validation/frameworks/broken/static2.php.expected.json index dec1323..363a586 100644 --- a/validation/frameworks/broken/static2.php.expected.json +++ b/validation/frameworks/broken/static2.php.expected.json @@ -3,10 +3,10 @@ "MyNamespace\\B": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/static2.php" ], - "STATIC::b()": [ + "MyNamespace\\A::b()": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/static2.php" ], - "STATIC": [ + "static": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/static2.php" ] }, diff --git a/validation/frameworks/broken/stringVariable.php.expected.json b/validation/frameworks/broken/stringVariable.php.expected.json index ce53869..7911934 100644 --- a/validation/frameworks/broken/stringVariable.php.expected.json +++ b/validation/frameworks/broken/stringVariable.php.expected.json @@ -1,9 +1,5 @@ { - "references": { - "B->hi": [ - "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/stringVariable.php" - ] - }, + "references": [], "definitions": { "B": { "extends": [], diff --git a/validation/frameworks/broken/testQualifiedNameOutsideOfNamespace.php.expected.json b/validation/frameworks/broken/testQualifiedNameOutsideOfNamespace.php.expected.json index 302e511..331b893 100644 --- a/validation/frameworks/broken/testQualifiedNameOutsideOfNamespace.php.expected.json +++ b/validation/frameworks/broken/testQualifiedNameOutsideOfNamespace.php.expected.json @@ -1,8 +1,5 @@ { "references": { - "SomeNamespace\\NameOutsideOfNamespace": [ - "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/testQualifiedNameOutsideOfNamespace.php" - ], "NameOutsideOfNamespace": [ "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/testQualifiedNameOutsideOfNamespace.php" ] diff --git a/validation/frameworks/broken/verifyFqsenOnClassProperty.php.expected.json b/validation/frameworks/broken/verifyFqsenOnClassProperty.php.expected.json index 73a81e9..b54f156 100644 --- a/validation/frameworks/broken/verifyFqsenOnClassProperty.php.expected.json +++ b/validation/frameworks/broken/verifyFqsenOnClassProperty.php.expected.json @@ -38,7 +38,7 @@ }, "containerName": "Foo" }, - "type__class": "phpDocumentor\\Reflection\\Types\\Mixed", + "type__class": "phpDocumentor\\Reflection\\Types\\Object_", "type": {}, "documentation": null },