Mercurial > hg > isophonics-drupal-site
comparison vendor/nikic/php-parser/test/PhpParser/CommentTest.php @ 13:5fb285c0d0e3
Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've
been lucky to get away with this so far, as we don't support self-registration
which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5
was vulnerable to.
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:33:26 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
12:7a779792577d | 13:5fb285c0d0e3 |
---|---|
1 <?php | 1 <?php declare(strict_types=1); |
2 | 2 |
3 namespace PhpParser; | 3 namespace PhpParser; |
4 | 4 |
5 class CommentTest extends \PHPUnit_Framework_TestCase | 5 use PHPUnit\Framework\TestCase; |
6 | |
7 class CommentTest extends TestCase | |
6 { | 8 { |
7 public function testGetSet() { | 9 public function testGetSet() { |
8 $comment = new Comment('/* Some comment */', 1, 10); | 10 $comment = new Comment('/* Some comment */', 1, 10, 2); |
9 | 11 |
10 $this->assertSame('/* Some comment */', $comment->getText()); | 12 $this->assertSame('/* Some comment */', $comment->getText()); |
11 $this->assertSame('/* Some comment */', (string) $comment); | 13 $this->assertSame('/* Some comment */', (string) $comment); |
12 $this->assertSame(1, $comment->getLine()); | 14 $this->assertSame(1, $comment->getLine()); |
13 $this->assertSame(10, $comment->getFilePos()); | 15 $this->assertSame(10, $comment->getFilePos()); |
16 $this->assertSame(2, $comment->getTokenPos()); | |
14 } | 17 } |
15 | 18 |
16 /** | 19 /** |
17 * @dataProvider provideTestReformatting | 20 * @dataProvider provideTestReformatting |
18 */ | 21 */ |
20 $comment = new Comment($commentText); | 23 $comment = new Comment($commentText); |
21 $this->assertSame($reformattedText, $comment->getReformattedText()); | 24 $this->assertSame($reformattedText, $comment->getReformattedText()); |
22 } | 25 } |
23 | 26 |
24 public function provideTestReformatting() { | 27 public function provideTestReformatting() { |
25 return array( | 28 return [ |
26 array('// Some text' . "\n", '// Some text'), | 29 ['// Some text' . "\n", '// Some text'], |
27 array('/* Some text */', '/* Some text */'), | 30 ['/* Some text */', '/* Some text */'], |
28 array( | 31 [ |
29 '/** | 32 '/** |
30 * Some text. | 33 * Some text. |
31 * Some more text. | 34 * Some more text. |
32 */', | 35 */', |
33 '/** | 36 '/** |
34 * Some text. | 37 * Some text. |
35 * Some more text. | 38 * Some more text. |
36 */' | 39 */' |
37 ), | 40 ], |
38 array( | 41 [ |
39 '/* | 42 '/* |
40 Some text. | 43 Some text. |
41 Some more text. | 44 Some more text. |
42 */', | 45 */', |
43 '/* | 46 '/* |
44 Some text. | 47 Some text. |
45 Some more text. | 48 Some more text. |
46 */' | 49 */' |
47 ), | 50 ], |
48 array( | 51 [ |
49 '/* Some text. | 52 '/* Some text. |
50 More text. | 53 More text. |
51 Even more text. */', | 54 Even more text. */', |
52 '/* Some text. | 55 '/* Some text. |
53 More text. | 56 More text. |
54 Even more text. */' | 57 Even more text. */' |
55 ), | 58 ], |
56 array( | 59 [ |
57 '/* Some text. | 60 '/* Some text. |
58 More text. | 61 More text. |
59 Indented text. */', | 62 Indented text. */', |
60 '/* Some text. | 63 '/* Some text. |
61 More text. | 64 More text. |
62 Indented text. */', | 65 Indented text. */', |
63 ), | 66 ], |
64 // invalid comment -> no reformatting | 67 // invalid comment -> no reformatting |
65 array( | 68 [ |
66 'hallo | 69 'hallo |
67 world', | 70 world', |
68 'hallo | 71 'hallo |
69 world', | 72 world', |
70 ), | 73 ], |
71 ); | 74 ]; |
72 } | 75 } |
73 } | 76 } |