1
0
Fork 0

Update baselines - failing tests are verified as expected

pull/357/head
Rob Lourens 2017-05-01 21:32:01 -07:00
parent ede5edc40d
commit ce548deb9d
17 changed files with 38 additions and 55 deletions

View File

@ -61,7 +61,7 @@ class ValidationTest extends TestCase
$fileContents = file_get_contents($testCaseFile); $fileContents = file_get_contents($testCaseFile);
$expectedValues = $this->getExpectedTestValues($testCaseFile, $frameworkName, $fileContents); $expectedValues = $this->getExpectedTestValues($testCaseFile, $frameworkName, $fileContents);
$actualValues = $this->getActualTestValues($testCaseFile, $fileContents); $actualValues = $this->getActualTestValues($testCaseFile, $frameworkName, $fileContents);
$this->assertEquals($expectedValues['definitions'], $actualValues['definitions']); $this->assertEquals($expectedValues['definitions'], $actualValues['definitions']);
@ -111,14 +111,10 @@ class ValidationTest extends TestCase
'definitions' => json_decode(json_encode($expectedDefs)) 'definitions' => json_decode(json_encode($expectedDefs))
); );
if ($frameworkName === 'broken') {
file_put_contents($outputFile, json_encode($refsAndDefs, JSON_PRETTY_PRINT));
}
return $refsAndDefs; return $refsAndDefs;
} }
private function getActualTestValues($filename, $fileContents): array { private function getActualTestValues($filename, $frameworkName, $fileContents): array {
global $parserKind; global $parserKind;
$parserKind = ParserKind::TOLERANT_PHP_PARSER; $parserKind = ParserKind::TOLERANT_PHP_PARSER;
@ -133,12 +129,19 @@ class ValidationTest extends TestCase
$this->filterSkippedReferences($actualRefs); $this->filterSkippedReferences($actualRefs);
$actualDefs = $this->getTestValuesFromDefs($document->getDefinitions()); $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. // to the real results. json_decode returns stdClass Objects, not arrays.
return array( $refsAndDefs = array(
'references' => json_decode(json_encode($actualRefs)), 'references' => json_decode(json_encode($actualRefs)),
'definitions' => json_decode(json_encode($actualDefs)) '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;
} }
/** /**

View File

@ -60,7 +60,7 @@
}, },
"containerName": "Fixtures\\Prophecy\\WithReturnTypehints" "containerName": "Fixtures\\Prophecy\\WithReturnTypehints"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__class": "phpDocumentor\\Reflection\\Types\\Object_",
"type": {}, "type": {},
"documentation": null "documentation": null
}, },
@ -94,7 +94,7 @@
}, },
"containerName": "Fixtures\\Prophecy\\WithReturnTypehints" "containerName": "Fixtures\\Prophecy\\WithReturnTypehints"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__class": "phpDocumentor\\Reflection\\Types\\Object_",
"type": {}, "type": {},
"documentation": null "documentation": null
} }

View File

@ -2,9 +2,6 @@
"references": { "references": {
"MyNamespace\\PHP_INT_MAX": [ "MyNamespace\\PHP_INT_MAX": [
"\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/constants5.php" "\/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": { "definitions": {
@ -55,7 +52,7 @@
}, },
"containerName": "MyNamespace\\Mbstring" "containerName": "MyNamespace\\Mbstring"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__class": "phpDocumentor\\Reflection\\Types\\Object_",
"type": {}, "type": {},
"documentation": null "documentation": null
} }

View File

@ -3,7 +3,7 @@
"LanguageServer": [ "LanguageServer": [
"\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/functionUse2.php" "\/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" "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/functionUse2.php"
] ]
}, },

View File

@ -12,10 +12,10 @@
"MyNamespace\\ClassLoader->prefixesPsr0": [ "MyNamespace\\ClassLoader->prefixesPsr0": [
"\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/memberAccess3.php" "\/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" "\/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" "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/memberAccess3.php"
], ],
"MyNamespace\\ClassLoader::class": [ "MyNamespace\\ClassLoader::class": [

View File

@ -3,6 +3,12 @@
"MyNamespace2\\MyNamespace1\\B": [ "MyNamespace2\\MyNamespace1\\B": [
"\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/multipleNamespaces.php" "\/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()": [ "MyNamespace2\\A->b()": [
"\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/multipleNamespaces.php" "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/multipleNamespaces.php"
] ]

View File

@ -31,9 +31,9 @@
}, },
"containerName": "Foo" "containerName": "Foo"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__class": "phpDocumentor\\Reflection\\Types\\Object_",
"type": {}, "type": {},
"documentation": null "documentation": "Foo"
} }
} }
} }

View File

@ -1,9 +1,5 @@
{ {
"references": { "references": [],
"static": [
"\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/nameToken.php"
]
},
"definitions": { "definitions": {
"A": { "A": {
"extends": [], "extends": [],

View File

@ -3,17 +3,11 @@
"MyNamespace\\B": [ "MyNamespace\\B": [
"\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/parent3.php" "\/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" "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/parent3.php"
], ],
"parent": [ "parent": [
"\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/parent3.php" "\/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": { "definitions": {

View File

@ -1,9 +1,9 @@
{ {
"references": { "references": {
"A::$a": [ "A": [
"\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/scopedPropertyAccess3.php" "\/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" "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/scopedPropertyAccess3.php"
] ]
}, },

View File

@ -3,10 +3,10 @@
"TestInterface": [ "TestInterface": [
"\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/scopedPropertyAccess5.php" "\/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" "\/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" "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/scopedPropertyAccess5.php"
], ],
"TestClass::$staticTestProperty": [ "TestClass::$staticTestProperty": [

View File

@ -3,10 +3,10 @@
"MyNamespace\\B": [ "MyNamespace\\B": [
"\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/self2.php" "\/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" "\/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" "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/self2.php"
] ]
}, },

View File

@ -3,17 +3,11 @@
"MyNamespace\\B": [ "MyNamespace\\B": [
"\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/self3.php" "\/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" "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/self3.php"
], ],
"self": [ "self": [
"\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/self3.php" "\/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": { "definitions": {

View File

@ -3,10 +3,10 @@
"MyNamespace\\B": [ "MyNamespace\\B": [
"\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/static2.php" "\/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" "\/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" "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/static2.php"
] ]
}, },

View File

@ -1,9 +1,5 @@
{ {
"references": { "references": [],
"B->hi": [
"\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/stringVariable.php"
]
},
"definitions": { "definitions": {
"B": { "B": {
"extends": [], "extends": [],

View File

@ -1,8 +1,5 @@
{ {
"references": { "references": {
"SomeNamespace\\NameOutsideOfNamespace": [
"\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/testQualifiedNameOutsideOfNamespace.php"
],
"NameOutsideOfNamespace": [ "NameOutsideOfNamespace": [
"\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/testQualifiedNameOutsideOfNamespace.php" "\/Users\/roblou\/code\/php-language-server\/tests\/Validation\/..\/..\/validation\/frameworks\/broken\/testQualifiedNameOutsideOfNamespace.php"
] ]

View File

@ -38,7 +38,7 @@
}, },
"containerName": "Foo" "containerName": "Foo"
}, },
"type__class": "phpDocumentor\\Reflection\\Types\\Mixed", "type__class": "phpDocumentor\\Reflection\\Types\\Object_",
"type": {}, "type": {},
"documentation": null "documentation": null
}, },