@@ -16,9 +16,9 @@ final class HtmlMinTest extends \PHPUnit\Framework\TestCase
16
16
17
17
public function testEmptyResult ()
18
18
{
19
- static ::assertSame ('' , $ this -> compressor ->minify (null ));
20
- static ::assertSame ('' , $ this -> compressor ->minify (' ' ));
21
- static ::assertSame ('' , $ this -> compressor ->minify ('' ));
19
+ static ::assertSame ('' , ( new HtmlMin ()) ->minify (null ));
20
+ static ::assertSame ('' , ( new HtmlMin ()) ->minify (' ' ));
21
+ static ::assertSame ('' , ( new HtmlMin ()) ->minify ('' ));
22
22
}
23
23
24
24
/**
@@ -200,45 +200,36 @@ public function providerTrim(): array
200
200
],
201
201
];
202
202
}
203
-
204
- protected function setUp ()
205
- {
206
- parent ::setUp ();
207
- $ this ->compressor = new HtmlMin ();
208
- }
209
-
210
- protected function tearDown ()
211
- {
212
- $ this ->compressor = null ;
213
- }
214
-
203
+
215
204
/**
216
205
* @dataProvider providerBoolAttr
217
206
*
218
207
* @param $input
219
208
*/
220
209
public function testBoolAttr ($ input )
221
210
{
211
+ $ minifier = new HtmlMin ();
212
+
222
213
$ html = '<!doctype html><html><body><form> ' . $ input . '</form></body></html> ' ;
223
214
$ expected = '<!DOCTYPE html><html><body><form><input autofocus checked type=checkbox></form> ' ;
224
215
225
- $ actual = $ this -> compressor ->minify ($ html );
216
+ $ actual = $ minifier ->minify ($ html );
226
217
static ::assertSame ($ expected , $ actual );
227
218
228
219
// ---
229
220
230
221
$ html = '<html><body><form> ' . $ input . '</form></body></html> ' ;
231
222
$ expected = '<html><body><form><input autofocus checked type=checkbox></form> ' ;
232
223
233
- $ actual = $ this -> compressor ->minify ($ html );
224
+ $ actual = $ minifier ->minify ($ html );
234
225
static ::assertSame ($ expected , $ actual );
235
226
236
227
// ---
237
228
238
229
$ html = '<form> ' . $ input . '</form> ' ;
239
230
$ expected = '<form><input autofocus checked type=checkbox></form> ' ;
240
231
241
- $ actual = $ this -> compressor ->minify ($ html );
232
+ $ actual = $ minifier ->minify ($ html );
242
233
static ::assertSame ($ expected , $ actual );
243
234
}
244
235
@@ -1388,7 +1379,7 @@ public function testForBrokenHtml()
1388
1379
*/
1389
1380
public function testMultipleSpaces ($ input , $ expected )
1390
1381
{
1391
- $ actual = $ this -> compressor ->minify ($ input );
1382
+ $ actual = ( new HtmlMin ()) ->minify ($ input );
1392
1383
static ::assertSame ($ expected , $ actual );
1393
1384
}
1394
1385
@@ -1400,7 +1391,7 @@ public function testMultipleSpaces($input, $expected)
1400
1391
*/
1401
1392
public function testNewLinesTabsReturns ($ input , $ expected )
1402
1393
{
1403
- $ actual = $ this -> compressor ->minify ($ input );
1394
+ $ actual = ( new HtmlMin ()) ->minify ($ input );
1404
1395
static ::assertSame ($ expected , $ actual );
1405
1396
}
1406
1397
@@ -1412,7 +1403,7 @@ public function testNewLinesTabsReturns($input, $expected)
1412
1403
*/
1413
1404
public function testSpaceAfterGt ($ input , $ expected )
1414
1405
{
1415
- $ actual = $ this -> compressor ->minify ($ input );
1406
+ $ actual = ( new HtmlMin ()) ->minify ($ input );
1416
1407
static ::assertSame ($ expected , $ actual );
1417
1408
}
1418
1409
@@ -1424,7 +1415,7 @@ public function testSpaceAfterGt($input, $expected)
1424
1415
*/
1425
1416
public function testSpaceBeforeLt ($ input , $ expected )
1426
1417
{
1427
- $ actual = $ this -> compressor ->minify ($ input );
1418
+ $ actual = ( new HtmlMin ()) ->minify ($ input );
1428
1419
static ::assertSame ($ expected , $ actual , 'tested: ' . $ input );
1429
1420
}
1430
1421
@@ -1436,7 +1427,7 @@ public function testSpaceBeforeLt($input, $expected)
1436
1427
*/
1437
1428
public function testSpecialCharacterEncoding ($ input , $ expected )
1438
1429
{
1439
- $ actual = $ this -> compressor ->minify ($ input , true );
1430
+ $ actual = ( new HtmlMin ()) ->minify ($ input , true );
1440
1431
static ::assertSame ($ expected , $ actual );
1441
1432
}
1442
1433
@@ -1448,13 +1439,15 @@ public function testSpecialCharacterEncoding($input, $expected)
1448
1439
*/
1449
1440
public function testTrim ($ input , $ expected )
1450
1441
{
1451
- $ actual = $ this -> compressor ->minify ($ input );
1442
+ $ actual = ( new HtmlMin ()) ->minify ($ input );
1452
1443
static ::assertSame ($ expected , $ actual );
1453
1444
}
1454
1445
1455
1446
public function testDoRemoveCommentsWithFalse ()
1456
1447
{
1457
- $ this ->compressor ->doRemoveComments (false );
1448
+ $ minifier = new HtmlMin ();
1449
+
1450
+ $ minifier ->doRemoveComments (false );
1458
1451
1459
1452
$ html = <<<'HTML'
1460
1453
<!DOCTYPE html>
@@ -1473,7 +1466,7 @@ public function testDoRemoveCommentsWithFalse()
1473
1466
1474
1467
HTML;
1475
1468
1476
- $ actual = $ this -> compressor ->minify ($ html );
1469
+ $ actual = $ minifier ->minify ($ html );
1477
1470
1478
1471
$ expectedHtml = <<<'HTML'
1479
1472
<!DOCTYPE html><html><head><title>Test</title> <body><!-- do not remove comment --> <hr> <!--
0 commit comments