@@ -28,16 +28,16 @@ final class EnumCaseTest extends AbstractMethodUnitTest
28
28
*/
29
29
public function testEnumCases ($ testMarker )
30
30
{
31
- $ tokens = self ::$ phpcsFile ->getTokens ();
31
+ $ tokens = self ::$ phpcsFile ->getTokens ();
32
+ $ enumCase = $ this ->getTargetToken ($ testMarker , [T_ENUM_CASE , T_CASE ]);
33
+ $ tokenArray = $ tokens [$ enumCase ];
32
34
33
- $ enumCase = $ this ->getTargetToken ($ testMarker , [T_ENUM_CASE , T_CASE ]);
35
+ $ this ->assertSame (T_ENUM_CASE , $ tokenArray ['code ' ], 'Token tokenized as ' .$ tokenArray ['type ' ].', not T_ENUM_CASE (code) ' );
36
+ $ this ->assertSame ('T_ENUM_CASE ' , $ tokenArray ['type ' ], 'Token tokenized as ' .$ tokenArray ['type ' ].', not T_ENUM_CASE (type) ' );
34
37
35
- $ this ->assertSame (T_ENUM_CASE , $ tokens [$ enumCase ]['code ' ]);
36
- $ this ->assertSame ('T_ENUM_CASE ' , $ tokens [$ enumCase ]['type ' ]);
37
-
38
- $ this ->assertArrayNotHasKey ('scope_condition ' , $ tokens [$ enumCase ], 'Scope condition is set ' );
39
- $ this ->assertArrayNotHasKey ('scope_opener ' , $ tokens [$ enumCase ], 'Scope opener is set ' );
40
- $ this ->assertArrayNotHasKey ('scope_closer ' , $ tokens [$ enumCase ], 'Scope closer is set ' );
38
+ $ this ->assertArrayNotHasKey ('scope_condition ' , $ tokenArray , 'Scope condition is set ' );
39
+ $ this ->assertArrayNotHasKey ('scope_opener ' , $ tokenArray , 'Scope opener is set ' );
40
+ $ this ->assertArrayNotHasKey ('scope_closer ' , $ tokenArray , 'Scope closer is set ' );
41
41
42
42
}//end testEnumCases()
43
43
@@ -77,16 +77,16 @@ public static function dataEnumCases()
77
77
*/
78
78
public function testNotEnumCases ($ testMarker )
79
79
{
80
- $ tokens = self ::$ phpcsFile ->getTokens ();
81
-
82
- $ case = $ this -> getTargetToken ( $ testMarker , [ T_ENUM_CASE , T_CASE ]) ;
80
+ $ tokens = self ::$ phpcsFile ->getTokens ();
81
+ $ case = $ this -> getTargetToken ( $ testMarker , [ T_ENUM_CASE , T_CASE ]);
82
+ $ tokenArray = $ tokens [ $ case ] ;
83
83
84
- $ this ->assertSame (T_CASE , $ tokens [ $ case ][ ' code ' ] );
85
- $ this ->assertSame ('T_CASE ' , $ tokens [ $ case ] ['type ' ]);
84
+ $ this ->assertSame (T_CASE , $ tokenArray [ ' code ' ], ' Token tokenized as ' . $ tokenArray [ ' type ' ]. ' , not T_CASE (code) ' );
85
+ $ this ->assertSame ('T_CASE ' , $ tokenArray [ ' type ' ], ' Token tokenized as ' . $ tokenArray ['type ' ]. ' , not T_CASE (type) ' );
86
86
87
- $ this ->assertArrayHasKey ('scope_condition ' , $ tokens [ $ case ] , 'Scope condition is not set ' );
88
- $ this ->assertArrayHasKey ('scope_opener ' , $ tokens [ $ case ] , 'Scope opener is not set ' );
89
- $ this ->assertArrayHasKey ('scope_closer ' , $ tokens [ $ case ] , 'Scope closer is not set ' );
87
+ $ this ->assertArrayHasKey ('scope_condition ' , $ tokenArray , 'Scope condition is not set ' );
88
+ $ this ->assertArrayHasKey ('scope_opener ' , $ tokenArray , 'Scope opener is not set ' );
89
+ $ this ->assertArrayHasKey ('scope_closer ' , $ tokenArray , 'Scope closer is not set ' );
90
90
91
91
}//end testNotEnumCases()
92
92
@@ -125,12 +125,12 @@ public static function dataNotEnumCases()
125
125
*/
126
126
public function testKeywordAsEnumCaseNameShouldBeString ($ testMarker )
127
127
{
128
- $ tokens = self ::$ phpcsFile ->getTokens ();
129
-
128
+ $ tokens = self ::$ phpcsFile ->getTokens ();
130
129
$ enumCaseName = $ this ->getTargetToken ($ testMarker , [T_STRING , T_INTERFACE , T_TRAIT , T_ENUM , T_FUNCTION , T_FALSE , T_DEFAULT , T_ARRAY ]);
130
+ $ tokenArray = $ tokens [$ enumCaseName ];
131
131
132
- $ this ->assertSame (T_STRING , $ tokens [ $ enumCaseName ][ ' code ' ] );
133
- $ this ->assertSame ('T_STRING ' , $ tokens [ $ enumCaseName ] ['type ' ]);
132
+ $ this ->assertSame (T_STRING , $ tokenArray [ ' code ' ], ' Token tokenized as ' . $ tokenArray [ ' type ' ]. ' , not T_STRING (code) ' );
133
+ $ this ->assertSame ('T_STRING ' , $ tokenArray [ ' type ' ], ' Token tokenized as ' . $ tokenArray ['type ' ]. ' , not T_STRING (type) ' );
134
134
135
135
}//end testKeywordAsEnumCaseNameShouldBeString()
136
136
0 commit comments