Skip to content

Commit

Permalink
updated test to check for form_params header instead of json
Browse files Browse the repository at this point in the history
  • Loading branch information
elmage committed Aug 19, 2020
1 parent 8d1431e commit 012c4a1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/Unit/HttpClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Elmage\TextNg\HttpClient;
use Elmage\TextNg\Configuration;
use GuzzleHttp\Psr7\Response;
use GuzzleHttp\RequestOptions;
use PHPUnit\Framework\Constraint\Callback;
use PHPUnit\Framework\MockObject\MockObject;
use GuzzleHttp\ClientInterface;
Expand Down Expand Up @@ -119,15 +120,15 @@ function ($request) use ($method, $path) {
);
}

private function isValidOptionsArray(array $headers = [], $json = true): Callback
private function isValidOptionsArray(array $headers = [], $form_params = true): Callback
{
return $this->callback(function ($options) use ($headers, $json) {
return $this->callback(function ($options) use ($headers, $form_params) {
$this->assertArrayHasKey('headers', $options);
$this->assertArrayHasKey('User-Agent', $options['headers']);
$this->assertArrayHasKey('Content-Type', $options['headers']);

if ($json) {
$this->assertArrayHasKey('json', $options);
if ($form_params) {
$this->assertArrayHasKey(RequestOptions::FORM_PARAMS, $options);
}

foreach ($headers as $header) {
Expand Down

0 comments on commit 012c4a1

Please sign in to comment.