@@ -385,51 +385,67 @@ public function dataComments()
385
385
);
386
386
}
387
387
388
- public function testBasicFunction ()
388
+ /**
389
+ * Test the tokenizer and token specific highlighting of text string tokens.
390
+ *
391
+ * @dataProvider dataTextStrings
392
+ *
393
+ * @param string $original The input string.
394
+ * @param string $expected The expected output string.
395
+ */
396
+ public function testTextStrings ($ original , $ expected )
389
397
{
390
- $ this ->compare (
391
- <<<'EOL'
392
- <?php
393
- function plus($a, $b) {
394
- return $a + $b;
395
- }
396
- EOL
397
- ,
398
- <<<'EOL'
399
- <token_default><?php</token_default>
400
- <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>
401
- <token_keyword> return </token_keyword><token_default>$a </token_default><token_keyword>+ </token_keyword><token_default>$b</token_default><token_keyword>;</token_keyword>
402
- <token_keyword>}</token_keyword>
403
- EOL
404
- );
398
+ $ this ->compare ($ original , $ expected );
405
399
}
406
400
407
- public function testStringNormal ()
401
+ /**
402
+ * Data provider for testing text string tokens.
403
+ *
404
+ * @return array
405
+ */
406
+ public function dataTextStrings ()
408
407
{
409
- $ this ->compare (
410
- <<<'EOL'
408
+ return array (
409
+ 'Single quoted text string ' => array (
410
+ 'original ' => <<<'EOL'
411
411
<?php
412
412
echo 'Ahoj světe';
413
413
EOL
414
- ,
415
- <<<'EOL'
414
+ ,
415
+ ' expected ' => <<<'EOL'
416
416
<token_default><?php</token_default>
417
417
<token_keyword>echo </token_keyword><token_string>'Ahoj světe'</token_string><token_keyword>;</token_keyword>
418
418
EOL
419
+ ),
420
+ 'Double quoted text string ' => array (
421
+ 'original ' => <<<'EOL'
422
+ <?php
423
+ echo "Ahoj světe";
424
+ EOL
425
+ ,
426
+ 'expected ' => <<<'EOL'
427
+ <token_default><?php</token_default>
428
+ <token_keyword>echo </token_keyword><token_string>"Ahoj světe"</token_string><token_keyword>;</token_keyword>
429
+ EOL
430
+ ),
419
431
);
420
432
}
421
433
422
- public function testStringDouble ()
434
+ public function testBasicFunction ()
423
435
{
424
436
$ this ->compare (
425
437
<<<'EOL'
426
438
<?php
427
- echo "Ahoj světe";
439
+ function plus($a, $b) {
440
+ return $a + $b;
441
+ }
428
442
EOL
429
443
,
430
444
<<<'EOL'
431
445
<token_default><?php</token_default>
432
- <token_keyword>echo </token_keyword><token_string>"Ahoj světe"</token_string><token_keyword>;</token_keyword>
446
+ <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>
447
+ <token_keyword> return </token_keyword><token_default>$a </token_default><token_keyword>+ </token_keyword><token_default>$b</token_default><token_keyword>;</token_keyword>
448
+ <token_keyword>}</token_keyword>
433
449
EOL
434
450
);
435
451
}
0 commit comments