@@ -182,6 +182,11 @@ public function spaceAfterRuleName(): void
182
182
*/
183
183
public function spaceRules (): void
184
184
{
185
+ $ outputFormat = OutputFormat::create ()
186
+ ->setSpaceBeforeRules ("\n" )
187
+ ->setSpaceBetweenRules ("\n" )
188
+ ->setSpaceAfterRules ("\n" );
189
+
185
190
self ::assertSame ('.main, .test {
186
191
font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;
187
192
background: white;
@@ -190,27 +195,40 @@ public function spaceRules(): void
190
195
background-size: 100% 100%;
191
196
font-size: 1.3em;
192
197
background-color: #fff;
193
- }} ' , $ this ->document ->render (OutputFormat:: create ()-> set ( ' Space*Rules ' , "\n" ) ));
198
+ }} ' , $ this ->document ->render ($ outputFormat ));
194
199
}
195
200
196
201
/**
197
202
* @test
198
203
*/
199
204
public function spaceBlocks (): void
200
205
{
206
+ $ outputFormat = OutputFormat::create ()
207
+ ->setSpaceBeforeBlocks ("\n" )
208
+ ->setSpaceBetweenBlocks ("\n" )
209
+ ->setSpaceAfterBlocks ("\n" );
210
+
201
211
self ::assertSame ('
202
212
.main, .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
203
213
@media screen {
204
214
.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}
205
215
}
206
- ' , $ this ->document ->render (OutputFormat:: create ()-> set ( ' Space*Blocks ' , "\n" ) ));
216
+ ' , $ this ->document ->render ($ outputFormat ));
207
217
}
208
218
209
219
/**
210
220
* @test
211
221
*/
212
222
public function spaceBoth (): void
213
223
{
224
+ $ outputFormat = OutputFormat::create ()
225
+ ->setSpaceBeforeRules ("\n" )
226
+ ->setSpaceBetweenRules ("\n" )
227
+ ->setSpaceAfterRules ("\n" )
228
+ ->setSpaceBeforeBlocks ("\n" )
229
+ ->setSpaceBetweenBlocks ("\n" )
230
+ ->setSpaceAfterBlocks ("\n" );
231
+
214
232
self ::assertSame ('
215
233
.main, .test {
216
234
font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;
@@ -223,18 +241,21 @@ public function spaceBoth(): void
223
241
background-color: #fff;
224
242
}
225
243
}
226
- ' , $ this ->document ->render (OutputFormat:: create ()-> set ( ' Space*Rules ' , "\n" )-> set ( ' Space*Blocks ' , "\n" ) ));
244
+ ' , $ this ->document ->render ($ outputFormat ));
227
245
}
228
246
229
247
/**
230
248
* @test
231
249
*/
232
250
public function spaceBetweenBlocks (): void
233
251
{
252
+ $ outputFormat = OutputFormat::create ()
253
+ ->setSpaceBetweenBlocks ('' );
254
+
234
255
self ::assertSame (
235
256
'.main, .test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;} '
236
257
. '@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}} ' ,
237
- $ this ->document ->render (OutputFormat:: create ()-> setSpaceBetweenBlocks ( '' ) )
258
+ $ this ->document ->render ($ outputFormat )
238
259
);
239
260
}
240
261
@@ -243,6 +264,15 @@ public function spaceBetweenBlocks(): void
243
264
*/
244
265
public function indentation (): void
245
266
{
267
+ $ outputFormat = OutputFormat::create ()
268
+ ->setSpaceBeforeRules ("\n" )
269
+ ->setSpaceBetweenRules ("\n" )
270
+ ->setSpaceAfterRules ("\n" )
271
+ ->setSpaceBeforeBlocks ("\n" )
272
+ ->setSpaceBetweenBlocks ("\n" )
273
+ ->setSpaceAfterBlocks ("\n" )
274
+ ->setIndentation ('' );
275
+
246
276
self ::assertSame ('
247
277
.main, .test {
248
278
font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;
@@ -255,21 +285,21 @@ public function indentation(): void
255
285
background-color: #fff;
256
286
}
257
287
}
258
- ' , $ this ->document ->render (OutputFormat::create ()
259
- ->set ('Space*Rules ' , "\n" )
260
- ->set ('Space*Blocks ' , "\n" )
261
- ->setIndentation ('' )));
288
+ ' , $ this ->document ->render ($ outputFormat ));
262
289
}
263
290
264
291
/**
265
292
* @test
266
293
*/
267
294
public function spaceBeforeBraces (): void
268
295
{
296
+ $ outputFormat = OutputFormat::create ()
297
+ ->setSpaceBeforeOpeningBrace ('' );
298
+
269
299
self ::assertSame (
270
300
'.main, .test{font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
271
301
@media screen{.main{background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}} ' ,
272
- $ this ->document ->render (OutputFormat:: create ()-> setSpaceBeforeOpeningBrace ( '' ) )
302
+ $ this ->document ->render ($ outputFormat )
273
303
);
274
304
}
275
305
@@ -280,30 +310,34 @@ public function ignoreExceptionsOff(): void
280
310
{
281
311
$ this ->expectException (OutputException::class);
282
312
313
+ $ outputFormat = OutputFormat::create ()->setIgnoreExceptions (false );
314
+
283
315
$ declarationBlocks = $ this ->document ->getAllDeclarationBlocks ();
284
316
$ firstDeclarationBlock = $ declarationBlocks [0 ];
285
317
$ firstDeclarationBlock ->removeSelector ('.main ' );
286
318
self ::assertSame (
287
319
'.test {font: italic normal bold 16px/1.2 "Helvetica",Verdana,sans-serif;background: white;}
288
320
@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}} ' ,
289
- $ this ->document ->render (OutputFormat:: create ()-> setIgnoreExceptions ( false ) )
321
+ $ this ->document ->render ($ outputFormat )
290
322
);
291
323
$ firstDeclarationBlock ->removeSelector ('.test ' );
292
- $ this ->document ->render (OutputFormat:: create ()-> setIgnoreExceptions ( false ) );
324
+ $ this ->document ->render ($ outputFormat );
293
325
}
294
326
295
327
/**
296
328
* @test
297
329
*/
298
330
public function ignoreExceptionsOn (): void
299
331
{
332
+ $ outputFormat = OutputFormat::create ()->setIgnoreExceptions (true );
333
+
300
334
$ declarationBlocks = $ this ->document ->getAllDeclarationBlocks ();
301
335
$ firstDeclarationBlock = $ declarationBlocks [0 ];
302
336
$ firstDeclarationBlock ->removeSelector ('.main ' );
303
337
$ firstDeclarationBlock ->removeSelector ('.test ' );
304
338
self ::assertSame (
305
339
'@media screen {.main {background-size: 100% 100%;font-size: 1.3em;background-color: #fff;}} ' ,
306
- $ this ->document ->render (OutputFormat:: create ()-> setIgnoreExceptions ( true ) )
340
+ $ this ->document ->render ($ outputFormat )
307
341
);
308
342
}
309
343
}
0 commit comments