Skip to content
This repository was archived by the owner on Jul 18, 2018. It is now read-only.

Commit f323f15

Browse files
roblourenslialan
authored andcommitted
Assert that references array is equal, not a subset, and update expected.json files (felixfbecker#395)
1 parent 97d3007 commit f323f15

9 files changed

+45
-10
lines changed

tests/Validation/ValidationTest.php

+1-6
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,7 @@ public function testDefinitionsAndReferences($testCaseFile)
6464

6565
try {
6666
$this->assertEquals($expectedValues['definitions'], $actualValues['definitions']);
67-
68-
try {
69-
$this->assertArraySubset((array)$expectedValues['references'], (array)$actualValues['references'], false, 'references don\'t match.');
70-
} catch (\Throwable $e) {
71-
$this->assertEquals((array)$expectedValues['references'], (array)$actualValues['references'], 'references don\'t match.');
72-
}
67+
$this->assertEquals((array)$expectedValues['references'], (array)$actualValues['references'], 'references don\'t match.');
7368
} catch (\Throwable $e) {
7469
$outputFile = getExpectedValuesFile($testCaseFile);
7570
file_put_contents($outputFile, json_encode($actualValues, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES));

tests/Validation/cases/WithReturnTypehints.php.expected.json

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
"self": [
77
"./WithReturnTypehints.php"
88
],
9+
"Fixtures\\Prophecy\\__CLASS__": [
10+
"./WithReturnTypehints.php"
11+
],
12+
"__CLASS__": [
13+
"./WithReturnTypehints.php"
14+
],
915
"parent": [
1016
"./WithReturnTypehints.php"
1117
]

tests/Validation/cases/exceptions1.php.expected.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
2-
"references": [],
2+
"references": {
3+
"MyNamespace\\Exception": [
4+
"./exceptions1.php"
5+
]
6+
},
37
"definitions": {
48
"MyNamespace": {
59
"fqn": "MyNamespace",

tests/Validation/cases/functionUse2.php.expected.json

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"LanguageServer": [
44
"./functionUse2.php"
55
],
6+
"LanguageServer\\pathToUri()": [
7+
"./functionUse2.php"
8+
],
69
"LanguageServer\\timeout()": [
710
"./functionUse2.php"
811
]

tests/Validation/cases/magicConstantsShouldBeGlobal.php.expected.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
{
2-
"references": [],
2+
"references": {
3+
"B\\__FILE__": [
4+
"./magicConstantsShouldBeGlobal.php"
5+
],
6+
"__FILE__": [
7+
"./magicConstantsShouldBeGlobal.php"
8+
]
9+
},
310
"definitions": {
411
"B": {
512
"fqn": "B",

tests/Validation/cases/magicConsts.php.expected.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
2-
"references": [],
2+
"references": {
3+
"__CLASS__": [
4+
"./magicConsts.php"
5+
]
6+
},
37
"definitions": {
48
"A": {
59
"fqn": "A",

tests/Validation/cases/memberAccess5.php.expected.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
2-
"references": [],
2+
"references": {
3+
"MyNamespace\\ParseErrorsTest->args": [
4+
"./memberAccess5.php"
5+
]
6+
},
37
"definitions": {
48
"MyNamespace": {
59
"fqn": "MyNamespace",

tests/Validation/cases/namespaces8.php.expected.json

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
"references": {
33
"LanguageServer": [
44
"./namespaces8.php"
5+
],
6+
"LanguageServer\\pathToUri()": [
7+
"./namespaces8.php"
8+
],
9+
"LanguageServer\\uriToPath()": [
10+
"./namespaces8.php"
511
]
612
},
713
"definitions": {

tests/Validation/cases/self4.php.expected.json

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
"MyNamespace\\A->addTestFile()": [
77
"./self4.php"
88
],
9+
"MyNamespace\\__DIR__": [
10+
"./self4.php"
11+
],
12+
"__DIR__": [
13+
"./self4.php"
14+
],
915
"MyNamespace\\DS": [
1016
"./self4.php"
1117
],

0 commit comments

Comments
 (0)