From 0596b8782286776588fa84df273127b41393e484 Mon Sep 17 00:00:00 2001 From: George Mponos Date: Tue, 27 Nov 2018 21:17:05 +0200 Subject: [PATCH 1/3] Use isset over array_key_exists --- src/Client.php | 6 +++--- tests/ClientTest.php | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/Client.php b/src/Client.php index f2bb184..74d3e6e 100644 --- a/src/Client.php +++ b/src/Client.php @@ -1,5 +1,5 @@ getMockBuilder(Client::class)->disableOriginalConstructor() + ->setMethods(['__none__'])->getMock(); + + $createHeaders = new \ReflectionMethod(Client::class, 'createHeaders'); + $createHeaders->setAccessible(true); + + $request = new Request(); + $request = $request->withHeader('content-length', 0); + + $headers = $createHeaders->invoke($client, $request, [CURLOPT_POSTFIELDS => null]); + + static::assertContains('Expect:', $headers); + } + public function testRewindStream() { $client = $this->getMockBuilder(Client::class)->disableOriginalConstructor() From 0e02605dbdc4a61fe38534d01dbcdb537714d639 Mon Sep 17 00:00:00 2001 From: George Mponos Date: Tue, 27 Nov 2018 21:21:15 +0200 Subject: [PATCH 2/3] Fix assertion --- tests/ClientTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ClientTest.php b/tests/ClientTest.php index bd94623..2fd94ee 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -51,7 +51,7 @@ public function testWithNullPostFields() $headers = $createHeaders->invoke($client, $request, [CURLOPT_POSTFIELDS => null]); - static::assertContains('Expect:', $headers); + static::assertContains('content-length: 0', $headers); } public function testRewindStream() From 2ae49a46cc2fc718ad6b1d781a2d45d4ece95342 Mon Sep 17 00:00:00 2001 From: George Mponos Date: Tue, 27 Nov 2018 21:58:13 +0200 Subject: [PATCH 3/3] Fix test with lowest dep --- tests/ClientTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ClientTest.php b/tests/ClientTest.php index 2fd94ee..89c5599 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -47,7 +47,7 @@ public function testWithNullPostFields() $createHeaders->setAccessible(true); $request = new Request(); - $request = $request->withHeader('content-length', 0); + $request = $request->withHeader('content-length', '0'); $headers = $createHeaders->invoke($client, $request, [CURLOPT_POSTFIELDS => null]);