44
55namespace Tests \Webclient \Extension \Log ;
66
7- use Nyholm \Psr7 \Request ;
8- use Nyholm \Psr7 \Response ;
7+ use GuzzleHttp \Psr7 \Request ;
8+ use GuzzleHttp \Psr7 \Response ;
99use PHPUnit \Framework \TestCase ;
1010use Stuff \Webclient \Extension \Log \Error ;
1111use Webclient \Extension \Log \Formatter \RawHttpFormatter ;
@@ -23,13 +23,6 @@ class RawHttpFormatterTest extends TestCase
2323 */
2424 private $ formatter ;
2525
26- public function setUp ()
27- {
28- parent ::setUp ();
29- $ this ->id = 'r1 ' ;
30- $ this ->formatter = new RawHttpFormatter ();
31- }
32-
3326 /**
3427 * @param string $method
3528 * @param string $uri
@@ -41,6 +34,7 @@ public function setUp()
4134 */
4235 public function testRequest (string $ method , string $ uri , array $ headers , string $ body , string $ protocolVersion )
4336 {
37+ $ this ->init ();
4438 $ request = new Request ($ method , $ uri , $ headers , $ body , $ protocolVersion );
4539 $ expected = 'Request ' . $ this ->id . PHP_EOL ;
4640 $ expected .= $ method . ' ' . $ uri . ' HTTP/ ' . $ protocolVersion . PHP_EOL ;
@@ -65,6 +59,7 @@ public function testRequest(string $method, string $uri, array $headers, string
6559 */
6660 public function testResponse (int $ status , string $ phrase , array $ headers , string $ body , string $ protocolVersion )
6761 {
62+ $ this ->init ();
6863 $ response = new Response ($ status , $ headers , $ body , $ protocolVersion , $ phrase );
6964 $ expected = 'Response ' . $ this ->id . PHP_EOL ;
7065 $ expected .= 'HTTP/ ' . $ protocolVersion . ' ' . $ status . ' ' . $ phrase . PHP_EOL ;
@@ -82,6 +77,7 @@ public function testResponse(int $status, string $phrase, array $headers, string
8277 */
8378 public function testError (string $ message )
8479 {
80+ $ this ->init ();
8581 $ error = new Error ($ message );
8682 $ expected = 'Connection ' . $ this ->id . PHP_EOL ;
8783 $ expected .= 'Error: ' . $ message ;
@@ -115,4 +111,10 @@ public function provideError(): array
115111 ['Network error ' ],
116112 ];
117113 }
114+
115+ private function init ()
116+ {
117+ $ this ->id = 'r1 ' ;
118+ $ this ->formatter = new RawHttpFormatter ();
119+ }
118120}
0 commit comments