|
1 | 1 | <?php
|
| 2 | + |
2 | 3 | /**
|
3 | 4 | * This file is part of PHPWord - A pure PHP library for reading and writing
|
4 | 5 | * word processing documents.
|
@@ -85,21 +86,27 @@ public function testFontNames1(): void
|
85 | 86 |
|
86 | 87 | $style = Helper::getTextContent($xpath, '/html/head/style');
|
87 | 88 | $prg = preg_match('/^body[^\\r\\n]*/m', $style, $matches);
|
| 89 | + self::assertNotEmpty($matches); |
88 | 90 | self::assertSame(1, $prg);
|
89 | 91 | self::assertEquals('body {font-family: \'Courier New\'; font-size: 12pt;}', $matches[0]);
|
90 | 92 | $prg = preg_match('/^[.]style1[^\\r\\n]*/m', $style, $matches);
|
| 93 | + self::assertNotEmpty($matches); |
91 | 94 | self::assertSame(1, $prg);
|
92 | 95 | self::assertEquals('.style1 {font-family: \'Tahoma\'; font-size: 10pt; color: #1B2232; font-weight: bold;}', $matches[0]);
|
93 | 96 | $prg = preg_match('/^[.]style2[^\\r\\n]*/m', $style, $matches);
|
| 97 | + self::assertNotEmpty($matches); |
94 | 98 | self::assertSame(1, $prg);
|
95 | 99 | self::assertEquals('.style2 {font-family: \'Arial\'; font-size: 10pt;}', $matches[0]);
|
96 | 100 | $prg = preg_match('/^[.]style3[^\\r\\n]*/m', $style, $matches);
|
| 101 | + self::assertNotEmpty($matches); |
97 | 102 | self::assertSame(1, $prg);
|
98 | 103 | self::assertEquals('.style3 {font-family: \'hack attempt'}; display:none\'; font-size: 10pt;}', $matches[0]);
|
99 | 104 | $prg = preg_match('/^[.]style4[^\\r\\n]*/m', $style, $matches);
|
| 105 | + self::assertNotEmpty($matches); |
100 | 106 | self::assertSame(1, $prg);
|
101 | 107 | self::assertEquals('.style4 {font-family: \'padmaa 1.1\'; font-size: 10pt; font-weight: bold;}', $matches[0]);
|
102 | 108 | $prg = preg_match('/^[.]style5[^\\r\\n]*/m', $style, $matches);
|
| 109 | + self::assertNotEmpty($matches); |
103 | 110 | self::assertSame(1, $prg);
|
104 | 111 | self::assertEquals('.style5 {font-family: \'MingLiU-ExtB\'; font-size: 10pt; font-weight: bold;}', $matches[0]);
|
105 | 112 | }
|
@@ -135,18 +142,23 @@ public function testFontNames2(): void
|
135 | 142 |
|
136 | 143 | $style = Helper::getTextContent($xpath, '/html/head/style');
|
137 | 144 | $prg = preg_match('/^body[^\\r\\n]*/m', $style, $matches);
|
| 145 | + self::assertNotEmpty($matches); |
138 | 146 | self::assertSame(1, $prg);
|
139 | 147 | self::assertEquals('body {font-family: \'Courier New\'; font-size: 12pt;}', $matches[0]);
|
140 | 148 | $prg = preg_match('/^[.]style1[^\\r\\n]*/m', $style, $matches);
|
| 149 | + self::assertNotEmpty($matches); |
141 | 150 | self::assertSame(1, $prg);
|
142 | 151 | self::assertEquals('.style1 {font-family: \'Tahoma\'; font-size: 10pt; color: #1B2232; font-weight: bold;}', $matches[0]);
|
| 152 | + self::assertNotEmpty($matches); |
143 | 153 | $prg = preg_match('/^[.]style2[^\\r\\n]*/m', $style, $matches);
|
144 | 154 | self::assertSame(1, $prg);
|
145 | 155 | self::assertEquals('.style2 {font-family: \'Arial\', sans-serif; font-size: 10pt;}', $matches[0]);
|
146 | 156 | $prg = preg_match('/^[.]style3[^\\r\\n]*/m', $style, $matches);
|
| 157 | + self::assertNotEmpty($matches); |
147 | 158 | self::assertSame(1, $prg);
|
148 | 159 | self::assertEquals('.style3 {font-family: \'DejaVu Sans Monospace\', monospace; font-size: 10pt;}', $matches[0]);
|
149 | 160 | $prg = preg_match('/^[.]style4[^\\r\\n]*/m', $style, $matches);
|
| 161 | + self::assertNotEmpty($matches); |
150 | 162 | self::assertSame(1, $prg);
|
151 | 163 | self::assertEquals('.style4 {font-family: \'Arial\'; font-size: 10pt;}', $matches[0]);
|
152 | 164 | }
|
@@ -182,18 +194,23 @@ public function testFontNames3(): void
|
182 | 194 |
|
183 | 195 | $style = Helper::getTextContent($xpath, '/html/head/style');
|
184 | 196 | $prg = preg_match('/^body[^\\r\\n]*/m', $style, $matches);
|
| 197 | + self::assertNotEmpty($matches); |
185 | 198 | self::assertSame(1, $prg);
|
186 | 199 | self::assertEquals('body {font-family: \'Courier New\', monospace; font-size: 12pt;}', $matches[0]);
|
187 | 200 | $prg = preg_match('/^[.]style1[^\\r\\n]*/m', $style, $matches);
|
| 201 | + self::assertNotEmpty($matches); |
188 | 202 | self::assertSame(1, $prg);
|
189 | 203 | self::assertEquals('.style1 {font-family: \'Tahoma\'; font-size: 10pt; color: #1B2232; font-weight: bold;}', $matches[0]);
|
190 | 204 | $prg = preg_match('/^[.]style2[^\\r\\n]*/m', $style, $matches);
|
| 205 | + self::assertNotEmpty($matches); |
191 | 206 | self::assertSame(1, $prg);
|
192 | 207 | self::assertEquals('.style2 {font-family: \'Arial\', sans-serif; font-size: 10pt;}', $matches[0]);
|
193 | 208 | $prg = preg_match('/^[.]style3[^\\r\\n]*/m', $style, $matches);
|
| 209 | + self::assertNotEmpty($matches); |
194 | 210 | self::assertSame(1, $prg);
|
195 | 211 | self::assertEquals('.style3 {font-family: \'DejaVu Sans Monospace\', monospace; font-size: 10pt;}', $matches[0]);
|
196 | 212 | $prg = preg_match('/^[.]style4[^\\r\\n]*/m', $style, $matches);
|
| 213 | + self::assertNotEmpty($matches); |
197 | 214 | self::assertSame(1, $prg);
|
198 | 215 | self::assertEquals('.style4 {font-family: \'Arial\'; font-size: 10pt;}', $matches[0]);
|
199 | 216 | }
|
@@ -224,15 +241,19 @@ public function testWhiteSpace(): void
|
224 | 241 | self::assertNotFalse(preg_match('/^body[^\\r\\n]*/m', $style, $matches));
|
225 | 242 | self::assertEquals('body {font-family: \'Arial\'; font-size: 12pt; white-space: pre-wrap;}', $matches[0]);
|
226 | 243 | $prg = preg_match('/^[.]style1[^\\r\\n]*/m', $style, $matches);
|
| 244 | + self::assertNotEmpty($matches); |
227 | 245 | self::assertSame(1, $prg);
|
228 | 246 | self::assertEquals('.style1 {font-family: \'Courier New\'; font-size: 10pt; white-space: pre-wrap;}', $matches[0]);
|
229 | 247 | $prg = preg_match('/^[.]style2[^\\r\\n]*/m', $style, $matches);
|
| 248 | + self::assertNotEmpty($matches); |
230 | 249 | self::assertSame(1, $prg);
|
231 | 250 | self::assertEquals('.style2 {font-family: \'Courier New\'; font-size: 10pt;}', $matches[0]);
|
232 | 251 | $prg = preg_match('/^[.]style3[^\\r\\n]*/m', $style, $matches);
|
| 252 | + self::assertNotEmpty($matches); |
233 | 253 | self::assertSame(1, $prg);
|
234 | 254 | self::assertEquals('.style3 {font-family: \'Courier New\'; font-size: 10pt; white-space: normal;}', $matches[0]);
|
235 | 255 | $prg = preg_match('/^[.]style4[^\\r\\n]*/m', $style, $matches);
|
| 256 | + self::assertNotEmpty($matches); |
236 | 257 | self::assertSame(1, $prg);
|
237 | 258 | self::assertEquals('.style4 {font-family: \'Courier New\'; font-size: 10pt;}', $matches[0]);
|
238 | 259 | }
|
|
0 commit comments