15
15
class Extensions extends \PHPUnit \Framework \TestCase implements \PHPUnit \Runner \Hook
16
16
{
17
17
18
- private $ throttle ;
19
- private $ validator ;
18
+ private static $ throttle ;
19
+ private static $ validator ;
20
20
21
- public function setUp () : void
21
+ public static function setUpBeforeClass () : void
22
22
{
23
23
$ url = $ _ENV [__CLASS__ . '_url ' ] ?? 'http://127.0.0.1:8888 ' ;
24
24
$ throttleMicroSeconds = $ _ENV [__CLASS__ . '_delay ' ] ?? 0 ;
@@ -27,8 +27,8 @@ public function setUp() : void
27
27
throw new \PHPUnit \Framework \Exception ($ url . ' is not a valid URL ' );
28
28
}
29
29
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 );
32
32
}
33
33
34
34
public function assertNotWarningCss (string $ css , string $ message = '' ) : void
@@ -145,8 +145,8 @@ private function validateCss(string $css) : \HtmlValidator\Response
145
145
{
146
146
$ css = '<!DOCTYPE html><html><head><meta charset="utf-8" /><title>Title</title><style> ' . $ css . '</style></head><body><hr></body></html> ' ;
147
147
}
148
- $ this -> throttle ->delay ();
149
- $ response = $ this -> validator ->validateDocument ($ css );
148
+ self :: $ throttle ->delay ();
149
+ $ response = self :: $ validator ->validateDocument ($ css );
150
150
151
151
return $ response ;
152
152
}
@@ -157,8 +157,8 @@ private function validateHtml(string $html) : \HtmlValidator\Response
157
157
{
158
158
$ html = '<!DOCTYPE html><html><head><meta charset="utf-8" /><title>Title</title></head><body> ' . $ html . '</body></html> ' ;
159
159
}
160
- $ this -> throttle ->delay ();
161
- $ response = $ this -> validator ->validateDocument ($ html );
160
+ self :: $ throttle ->delay ();
161
+ $ response = self :: $ validator ->validateDocument ($ html );
162
162
163
163
return $ response ;
164
164
}
0 commit comments