11
11
12
12
use PHP_CodeSniffer \Tests \Core \Tokenizers \AbstractTokenizerTestCase ;
13
13
14
+ /**
15
+ * Tests the tokenization of goto declarations and statements.
16
+ *
17
+ * @covers PHP_CodeSniffer\Tokenizers\PHP::tokenize
18
+ */
14
19
final class GotoLabelTest extends AbstractTokenizerTestCase
15
20
{
16
21
@@ -22,7 +27,6 @@ final class GotoLabelTest extends AbstractTokenizerTestCase
22
27
* @param string $testContent The token content to expect.
23
28
*
24
29
* @dataProvider dataGotoStatement
25
- * @covers PHP_CodeSniffer\Tokenizers\PHP::tokenize
26
30
*
27
31
* @return void
28
32
*/
@@ -56,6 +60,14 @@ public static function dataGotoStatement()
56
60
'testMarker ' => '/* testGotoStatementInLoop */ ' ,
57
61
'testContent ' => 'end ' ,
58
62
],
63
+ 'label for goto statement in switch ' => [
64
+ 'testMarker ' => '/* testGotoStatementInSwitch */ ' ,
65
+ 'testContent ' => 'def ' ,
66
+ ],
67
+ 'label for goto statement within function ' => [
68
+ 'testMarker ' => '/* testGotoStatementInFunction */ ' ,
69
+ 'testContent ' => 'label ' ,
70
+ ],
59
71
];
60
72
61
73
}//end dataGotoStatement()
@@ -68,7 +80,6 @@ public static function dataGotoStatement()
68
80
* @param string $testContent The token content to expect.
69
81
*
70
82
* @dataProvider dataGotoDeclaration
71
- * @covers PHP_CodeSniffer\Tokenizers\PHP::tokenize
72
83
*
73
84
* @return void
74
85
*/
@@ -102,6 +113,14 @@ public static function dataGotoDeclaration()
102
113
'testMarker ' => '/* testGotoDeclarationOutsideLoop */ ' ,
103
114
'testContent ' => 'end: ' ,
104
115
],
116
+ 'label in goto declaration - def ' => [
117
+ 'testMarker ' => '/* testGotoDeclarationInSwitch */ ' ,
118
+ 'testContent ' => 'def: ' ,
119
+ ],
120
+ 'label in goto declaration - label ' => [
121
+ 'testMarker ' => '/* testGotoDeclarationInFunction */ ' ,
122
+ 'testContent ' => 'label: ' ,
123
+ ],
105
124
];
106
125
107
126
}//end dataGotoDeclaration()
@@ -114,7 +133,6 @@ public static function dataGotoDeclaration()
114
133
* @param string $testContent The token content to expect.
115
134
*
116
135
* @dataProvider dataNotAGotoDeclaration
117
- * @covers PHP_CodeSniffer\Tokenizers\PHP::tokenize
118
136
*
119
137
* @return void
120
138
*/
0 commit comments