Mercurial > hg > isophonics-drupal-site
comparison vendor/nikic/php-parser/test/PhpParser/CommentTest.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 5fb285c0d0e3 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace PhpParser; | |
4 | |
5 class CommentTest extends \PHPUnit_Framework_TestCase | |
6 { | |
7 public function testGetSet() { | |
8 $comment = new Comment('/* Some comment */', 1, 10); | |
9 | |
10 $this->assertSame('/* Some comment */', $comment->getText()); | |
11 $this->assertSame('/* Some comment */', (string) $comment); | |
12 $this->assertSame(1, $comment->getLine()); | |
13 $this->assertSame(10, $comment->getFilePos()); | |
14 } | |
15 | |
16 /** | |
17 * @dataProvider provideTestReformatting | |
18 */ | |
19 public function testReformatting($commentText, $reformattedText) { | |
20 $comment = new Comment($commentText); | |
21 $this->assertSame($reformattedText, $comment->getReformattedText()); | |
22 } | |
23 | |
24 public function provideTestReformatting() { | |
25 return array( | |
26 array('// Some text' . "\n", '// Some text'), | |
27 array('/* Some text */', '/* Some text */'), | |
28 array( | |
29 '/** | |
30 * Some text. | |
31 * Some more text. | |
32 */', | |
33 '/** | |
34 * Some text. | |
35 * Some more text. | |
36 */' | |
37 ), | |
38 array( | |
39 '/* | |
40 Some text. | |
41 Some more text. | |
42 */', | |
43 '/* | |
44 Some text. | |
45 Some more text. | |
46 */' | |
47 ), | |
48 array( | |
49 '/* Some text. | |
50 More text. | |
51 Even more text. */', | |
52 '/* Some text. | |
53 More text. | |
54 Even more text. */' | |
55 ), | |
56 array( | |
57 '/* Some text. | |
58 More text. | |
59 Indented text. */', | |
60 '/* Some text. | |
61 More text. | |
62 Indented text. */', | |
63 ), | |
64 // invalid comment -> no reformatting | |
65 array( | |
66 'hallo | |
67 world', | |
68 'hallo | |
69 world', | |
70 ), | |
71 ); | |
72 } | |
73 } |