|
6 | 6 | use PHPUnit\Framework\TestCase; |
7 | 7 |
|
8 | 8 | class KeywordEnhancerTest extends TestCase { |
9 | | - public static function dataLinkToSecurityAnnouncements(): array { |
10 | | - return [ |
11 | | - [ |
12 | | - 'eloadfont(). (CVE-2022-31630) (cmb)', |
13 | | - 'eloadfont(). ([CVE-2022-31630](https://nvd.nist.gov/vuln/detail/CVE-2022-31630)) (cmb)' |
14 | | - ], |
15 | | - [ |
16 | | - 'eloadfont(). (CVE-1987-31630) (cmb)', |
17 | | - 'eloadfont(). (CVE-1987-31630) (cmb)' |
18 | | - ], |
19 | | - [ |
20 | | - 'Fixed bug #81726: phar wrapper: DOS when using quine gzip file. (CVE-2022-31628). (cmb)', |
21 | | - 'Fixed bug [#81726](https://bugs.php.net/bug.php?id=81726): phar wrapper: DOS when using quine gzip file. ([CVE-2022-31628](https://nvd.nist.gov/vuln/detail/CVE-2022-31628)). (cmb)' |
22 | | - ], |
23 | | - ]; |
24 | | - } |
| 9 | + public static function dataLinkToSecurityAnnouncements(): array { |
| 10 | + return [ |
| 11 | + [ |
| 12 | + 'eloadfont(). (CVE-2022-31630) (cmb)', |
| 13 | + 'eloadfont(). ([CVE-2022-31630](https://nvd.nist.gov/vuln/detail/CVE-2022-31630)) (cmb)', |
| 14 | + ], |
| 15 | + [ |
| 16 | + 'eloadfont(). (CVE-1987-31630) (cmb)', |
| 17 | + 'eloadfont(). (CVE-1987-31630) (cmb)', |
| 18 | + ], |
| 19 | + [ |
| 20 | + 'Fixed bug #81726: phar wrapper: DOS when using quine gzip file. (CVE-2022-31628). (cmb)', |
| 21 | + 'Fixed bug [#81726](https://bugs.php.net/bug.php?id=81726): phar wrapper: DOS when using quine gzip file. ([CVE-2022-31628](https://nvd.nist.gov/vuln/detail/CVE-2022-31628)). (cmb)', |
| 22 | + ], |
| 23 | + ]; |
| 24 | + } |
25 | 25 |
|
26 | | - public static function dataLinksToBugsPhp(): array { |
27 | | - return [ |
28 | | - [ |
29 | | - 'Fixed bug #81739: OOB read due to', |
30 | | - 'Fixed bug [#81739](https://bugs.php.net/bug.php?id=81739): OOB read due to' |
31 | | - ], |
32 | | - [ |
33 | | - 'Fixed bug #45: OOB read due to', |
34 | | - 'Fixed bug #45: OOB read due to' |
35 | | - ], |
36 | | - [ |
37 | | - 'Fixed bug #5943: OOB read due to', |
38 | | - 'Fixed bug #5943: OOB read due to' |
39 | | - ], |
40 | | - [ |
41 | | - 'Fixed bug #11453: OOB read due to', |
42 | | - 'Fixed bug #11453: OOB read due to' |
43 | | - ], |
44 | | - [ |
45 | | - 'Fixed bug #123456: OOB read due to', |
46 | | - 'Fixed bug #123456: OOB read due to' |
47 | | - ], |
48 | | - ]; |
49 | | - } |
| 26 | + public static function dataLinksToBugsPhp(): array { |
| 27 | + return [ |
| 28 | + [ |
| 29 | + 'Fixed bug #81739: OOB read due to', |
| 30 | + 'Fixed bug [#81739](https://bugs.php.net/bug.php?id=81739): OOB read due to', |
| 31 | + ], |
| 32 | + [ |
| 33 | + 'Fixed bug #45: OOB read due to', |
| 34 | + 'Fixed bug #45: OOB read due to', |
| 35 | + ], |
| 36 | + [ |
| 37 | + 'Fixed bug #5943: OOB read due to', |
| 38 | + 'Fixed bug #5943: OOB read due to', |
| 39 | + ], |
| 40 | + [ |
| 41 | + 'Fixed bug #11453: OOB read due to', |
| 42 | + 'Fixed bug #11453: OOB read due to', |
| 43 | + ], |
| 44 | + [ |
| 45 | + 'Fixed bug #123456: OOB read due to', |
| 46 | + 'Fixed bug #123456: OOB read due to', |
| 47 | + ], |
| 48 | + ]; |
| 49 | + } |
50 | 50 |
|
51 | | - public static function dataLinkToGitHub(): array { |
52 | | - return [ |
53 | | - [ |
54 | | - 'Fixed bug GH-1: OOB read due to', |
55 | | - 'Fixed bug GH-1: OOB read due to' |
56 | | - ], |
57 | | - [ |
58 | | - 'Fixed bug GH-123: OOB read due to', |
59 | | - 'Fixed bug [GH-123](https://github.com/php/php-src/issues/123): OOB read due to' |
60 | | - ], |
61 | | - ]; |
62 | | - } |
| 51 | + public static function dataLinkToGitHub(): array { |
| 52 | + return [ |
| 53 | + [ |
| 54 | + 'Fixed bug GH-1: OOB read due to', |
| 55 | + 'Fixed bug GH-1: OOB read due to', |
| 56 | + ], |
| 57 | + [ |
| 58 | + 'Fixed bug GH-123: OOB read due to', |
| 59 | + 'Fixed bug [GH-123](https://github.com/php/php-src/issues/123): OOB read due to', |
| 60 | + ], |
| 61 | + ]; |
| 62 | + } |
63 | 63 |
|
64 | | - public static function dataCodifyText(): array { |
65 | | - return [ |
66 | | - [ 'password_hash()', '`password_hash()`' ], |
67 | | - [ '`password_hash()`', '`password_hash()`' ], |
68 | | - [ |
69 | | - '`password_hash()` and password_hash()', |
70 | | - '`password_hash()` and `password_hash()`' |
71 | | - ], |
72 | | - ]; |
73 | | - } |
| 64 | + public static function dataCodifyText(): array { |
| 65 | + return [ |
| 66 | + ['password_hash()', '`password_hash()`'], |
| 67 | + ['`password_hash()`', '`password_hash()`'], |
| 68 | + [ |
| 69 | + '`password_hash()` and password_hash()', |
| 70 | + '`password_hash()` and `password_hash()`', |
| 71 | + ], |
| 72 | + ['password_hash()', '`password_hash()`'], |
| 73 | + ]; |
| 74 | + } |
74 | 75 |
|
75 | | - /** |
76 | | - * @covers \PHPWatch\PhpKeywordEnhancer\KeywordEnhancer::enhance |
77 | | - */ |
78 | | - public function testReturnsVerbatimOnEmptyStrings(): void { |
79 | | - self::assertSame( '', KeywordEnhancer::enhance( '' ) ); |
80 | | - self::assertSame( ' ', KeywordEnhancer::enhance( ' ' ) ); |
81 | | - self::assertSame( 'test', KeywordEnhancer::enhance( 'test' ) ); |
82 | | - } |
| 76 | + /** |
| 77 | + * @covers \PHPWatch\PhpKeywordEnhancer\KeywordEnhancer::enhance |
| 78 | + */ |
| 79 | + public function testReturnsVerbatimOnEmptyStrings(): void { |
| 80 | + self::assertSame('', KeywordEnhancer::enhance('')); |
| 81 | + self::assertSame(' ', KeywordEnhancer::enhance(' ')); |
| 82 | + self::assertSame('test', KeywordEnhancer::enhance('test')); |
| 83 | + } |
83 | 84 |
|
84 | | - /** |
85 | | - * @covers \PHPWatch\PhpKeywordEnhancer\KeywordEnhancer::linkToBug |
86 | | - * @dataProvider dataLinksToBugsPhp |
87 | | - */ |
88 | | - public function testLinksToBugsPhp( string $input, string $expected ): void { |
89 | | - self::assertSame( $expected, KeywordEnhancer::enhance( $input ) ); |
90 | | - } |
| 85 | + /** |
| 86 | + * @covers \PHPWatch\PhpKeywordEnhancer\KeywordEnhancer::linkToBug |
| 87 | + * @dataProvider dataLinksToBugsPhp |
| 88 | + */ |
| 89 | + public function testLinksToBugsPhp(string $input, string $expected): void { |
| 90 | + self::assertSame($expected, KeywordEnhancer::enhance($input)); |
| 91 | + } |
91 | 92 |
|
92 | | - /** |
93 | | - * @covers \PHPWatch\PhpKeywordEnhancer\KeywordEnhancer::linkToGitHub |
94 | | - * @dataProvider dataLinkToGitHub |
95 | | - */ |
96 | | - public function testLinkToGitHub( string $input, string $expected ): void { |
97 | | - self::assertSame( $expected, KeywordEnhancer::enhance( $input ) ); |
98 | | - } |
| 93 | + /** |
| 94 | + * @covers \PHPWatch\PhpKeywordEnhancer\KeywordEnhancer::linkToGitHub |
| 95 | + * @dataProvider dataLinkToGitHub |
| 96 | + */ |
| 97 | + public function testLinkToGitHub(string $input, string $expected): void { |
| 98 | + self::assertSame($expected, KeywordEnhancer::enhance($input)); |
| 99 | + } |
99 | 100 |
|
100 | | - /** |
101 | | - * @covers \PHPWatch\PhpKeywordEnhancer\KeywordEnhancer::linkToSecurityAnnouncements |
102 | | - * @dataProvider dataLinkToSecurityAnnouncements |
103 | | - */ |
104 | | - public function testLinkToSecurityAnnouncements( string $input, string $expected ): void { |
105 | | - self::assertSame( $expected, KeywordEnhancer::enhance( $input ) ); |
106 | | - } |
| 101 | + /** |
| 102 | + * @covers \PHPWatch\PhpKeywordEnhancer\KeywordEnhancer::linkToSecurityAnnouncements |
| 103 | + * @dataProvider dataLinkToSecurityAnnouncements |
| 104 | + */ |
| 105 | + public function testLinkToSecurityAnnouncements(string $input, string $expected): void { |
| 106 | + self::assertSame($expected, KeywordEnhancer::enhance($input)); |
| 107 | + } |
107 | 108 |
|
108 | | - /** |
109 | | - * @covers \PHPWatch\PhpKeywordEnhancer\KeywordEnhancer::codifyText |
110 | | - * @dataProvider dataCodifyText |
111 | | - */ |
112 | | - public function testCodifyText( string $input, string $expected ): void { |
113 | | - self::assertSame( $expected, KeywordEnhancer::enhance( $input ) ); |
114 | | - } |
| 109 | + /** |
| 110 | + * @covers \PHPWatch\PhpKeywordEnhancer\KeywordEnhancer::codifyText |
| 111 | + * @dataProvider dataCodifyText |
| 112 | + */ |
| 113 | + public function testCodifyText(string $input, string $expected): void { |
| 114 | + self::assertSame($expected, KeywordEnhancer::enhance($input)); |
| 115 | + } |
115 | 116 |
|
116 | 117 |
|
117 | 118 | } |
0 commit comments