File tree Expand file tree Collapse file tree 1 file changed +36
-20
lines changed Expand file tree Collapse file tree 1 file changed +36
-20
lines changed Original file line number Diff line number Diff line change @@ -630,37 +630,53 @@ public function dataNameTokens()
630
630
return $ data ;
631
631
}
632
632
633
- public function testBasicFunction ()
633
+ /**
634
+ * Test the tokenizer and token specific highlighting of keyword and operator tokens.
635
+ *
636
+ * @dataProvider dataKeywordsAndOperators
637
+ *
638
+ * @param string $original The input string.
639
+ * @param string $expected The expected output string.
640
+ */
641
+ public function testKeywordsAndOperators ($ original , $ expected )
642
+ {
643
+ $ this ->compare ($ original , $ expected );
644
+ }
645
+
646
+ /**
647
+ * Data provider.
648
+ *
649
+ * @return array
650
+ */
651
+ public function dataKeywordsAndOperators ()
634
652
{
635
- $ this ->compare (
636
- <<<'EOL'
653
+ return array (
654
+ 'Keywords: instanceof ' => array (
655
+ 'original ' => <<<'EOL'
656
+ <?php
657
+ $a instanceof stdClass;
658
+ EOL
659
+ ,
660
+ 'expected ' => <<<'EOL'
661
+ <token_default><?php</token_default>
662
+ <token_default>$a </token_default><token_keyword>instanceof </token_keyword><token_default>stdClass</token_default><token_keyword>;</token_keyword>
663
+ EOL
664
+ ),
665
+ 'Keywords: function, return ' => array (
666
+ 'original ' => <<<'EOL'
637
667
<?php
638
668
function plus($a, $b) {
639
669
return $a + $b;
640
670
}
641
671
EOL
642
- ,
643
- <<<'EOL'
672
+ ,
673
+ ' expected ' => <<<'EOL'
644
674
<token_default><?php</token_default>
645
675
<token_keyword>function </token_keyword><token_default>plus</token_default><token_keyword>(</token_keyword><token_default>$a</token_default><token_keyword>, </token_keyword><token_default>$b</token_default><token_keyword>) {</token_keyword>
646
676
<token_keyword> return </token_keyword><token_default>$a </token_default><token_keyword>+ </token_keyword><token_default>$b</token_default><token_keyword>;</token_keyword>
647
677
<token_keyword>}</token_keyword>
648
678
EOL
649
- );
650
- }
651
-
652
- public function testInstanceof ()
653
- {
654
- $ this ->compare (
655
- <<<'EOL'
656
- <?php
657
- $a instanceof stdClass;
658
- EOL
659
- ,
660
- <<<'EOL'
661
- <token_default><?php</token_default>
662
- <token_default>$a </token_default><token_keyword>instanceof </token_keyword><token_default>stdClass</token_default><token_keyword>;</token_keyword>
663
- EOL
679
+ ),
664
680
);
665
681
}
666
682
}
You can’t perform that action at this time.
0 commit comments