Skip to content

Commit 082fb2c

Browse files
committed
setUp to setUpBeforeClass
1 parent 82c3379 commit 082fb2c

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "phpfui/html-unit-tester",
33
"description": "PHPUnit Testing extensions for HMTL and CSS",
44
"minimum-stability": "stable",
5-
"keywords": ["PHPUnit","html","css","unit","test","php"],
5+
"keywords": ["PHPUnit","html","css","unit","test","testing","validation"],
66
"homepage": "https://github.com/phpfui/HTMLUnitTester",
77
"license": "MIT",
88
"authors": [

src/PHPFUI/HTMLUnitTester/Extensions.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
class Extensions extends \PHPUnit\Framework\TestCase implements \PHPUnit\Runner\Hook
1616
{
1717

18-
private $throttle;
19-
private $validator;
18+
private static $throttle;
19+
private static $validator;
2020

21-
public function setUp() : void
21+
public static function setUpBeforeClass() : void
2222
{
2323
$url = $_ENV[__CLASS__ . '_url'] ?? 'http://127.0.0.1:8888';
2424
$throttleMicroSeconds = $_ENV[__CLASS__ . '_delay'] ?? 0;
@@ -27,8 +27,8 @@ public function setUp() : void
2727
throw new \PHPUnit\Framework\Exception($url . ' is not a valid URL');
2828
}
2929

30-
$this->throttle = new Throttle($throttleMicroSeconds);
31-
$this->validator = new \HtmlValidator\Validator($url);
30+
self::$throttle = new Throttle($throttleMicroSeconds);
31+
self::$validator = new \HtmlValidator\Validator($url);
3232
}
3333

3434
public function assertNotWarningCss(string $css, string $message = '') : void
@@ -145,8 +145,8 @@ private function validateCss(string $css) : \HtmlValidator\Response
145145
{
146146
$css = '<!DOCTYPE html><html><head><meta charset="utf-8" /><title>Title</title><style>' . $css . '</style></head><body><hr></body></html>';
147147
}
148-
$this->throttle->delay();
149-
$response = $this->validator->validateDocument($css);
148+
self::$throttle->delay();
149+
$response = self::$validator->validateDocument($css);
150150

151151
return $response;
152152
}
@@ -157,8 +157,8 @@ private function validateHtml(string $html) : \HtmlValidator\Response
157157
{
158158
$html = '<!DOCTYPE html><html><head><meta charset="utf-8" /><title>Title</title></head><body>' . $html . '</body></html>';
159159
}
160-
$this->throttle->delay();
161-
$response = $this->validator->validateDocument($html);
160+
self::$throttle->delay();
161+
$response = self::$validator->validateDocument($html);
162162

163163
return $response;
164164
}

0 commit comments

Comments
 (0)