1515class 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