@@ -28,16 +28,16 @@ final class EnumCaseTest extends AbstractMethodUnitTest
2828 */
2929 public function testEnumCases ($ testMarker )
3030 {
31- $ tokens = self ::$ phpcsFile ->getTokens ();
31+ $ tokens = self ::$ phpcsFile ->getTokens ();
32+ $ enumCase = $ this ->getTargetToken ($ testMarker , [T_ENUM_CASE , T_CASE ]);
33+ $ tokenArray = $ tokens [$ enumCase ];
3234
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) ' );
3437
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 ' );
4141
4242 }//end testEnumCases()
4343
@@ -77,16 +77,16 @@ public static function dataEnumCases()
7777 */
7878 public function testNotEnumCases ($ testMarker )
7979 {
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 ] ;
8383
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) ' );
8686
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 ' );
9090
9191 }//end testNotEnumCases()
9292
@@ -125,12 +125,12 @@ public static function dataNotEnumCases()
125125 */
126126 public function testKeywordAsEnumCaseNameShouldBeString ($ testMarker )
127127 {
128- $ tokens = self ::$ phpcsFile ->getTokens ();
129-
128+ $ tokens = self ::$ phpcsFile ->getTokens ();
130129 $ enumCaseName = $ this ->getTargetToken ($ testMarker , [T_STRING , T_INTERFACE , T_TRAIT , T_ENUM , T_FUNCTION , T_FALSE , T_DEFAULT , T_ARRAY ]);
130+ $ tokenArray = $ tokens [$ enumCaseName ];
131131
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) ' );
134134
135135 }//end testKeywordAsEnumCaseNameShouldBeString()
136136
0 commit comments