1111
1212use PHP_CodeSniffer \Tests \Core \Tokenizers \AbstractTokenizerTestCase ;
1313
14+ /**
15+ * Tests the tokenization of goto declarations and statements.
16+ *
17+ * @covers PHP_CodeSniffer\Tokenizers\PHP::tokenize
18+ */
1419final class GotoLabelTest extends AbstractTokenizerTestCase
1520{
1621
@@ -22,7 +27,6 @@ final class GotoLabelTest extends AbstractTokenizerTestCase
2227 * @param string $testContent The token content to expect.
2328 *
2429 * @dataProvider dataGotoStatement
25- * @covers PHP_CodeSniffer\Tokenizers\PHP::tokenize
2630 *
2731 * @return void
2832 */
@@ -56,6 +60,14 @@ public static function dataGotoStatement()
5660 'testMarker ' => '/* testGotoStatementInLoop */ ' ,
5761 'testContent ' => 'end ' ,
5862 ],
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+ ],
5971 ];
6072
6173 }//end dataGotoStatement()
@@ -68,7 +80,6 @@ public static function dataGotoStatement()
6880 * @param string $testContent The token content to expect.
6981 *
7082 * @dataProvider dataGotoDeclaration
71- * @covers PHP_CodeSniffer\Tokenizers\PHP::tokenize
7283 *
7384 * @return void
7485 */
@@ -102,6 +113,14 @@ public static function dataGotoDeclaration()
102113 'testMarker ' => '/* testGotoDeclarationOutsideLoop */ ' ,
103114 'testContent ' => 'end: ' ,
104115 ],
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+ ],
105124 ];
106125
107126 }//end dataGotoDeclaration()
@@ -114,7 +133,6 @@ public static function dataGotoDeclaration()
114133 * @param string $testContent The token content to expect.
115134 *
116135 * @dataProvider dataNotAGotoDeclaration
117- * @covers PHP_CodeSniffer\Tokenizers\PHP::tokenize
118136 *
119137 * @return void
120138 */
0 commit comments