Skip to content

Commit

Permalink
Test the default option set via the withOptions method
Browse files Browse the repository at this point in the history
  • Loading branch information
ackintosh committed Aug 30, 2022
1 parent 9afc18e commit aab5494
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/Ackintosh/Ganesha/GaneshaHttpClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,16 @@ public function streamDelegatesToDecoratedInstance(): void
public function buildWithOptions(): void
{
$client = $this->buildClient();
$clientWithOptions = $client->withOptions(['headers' => ['Content-Type: text/html']]);
// Attach extra data to the request as default.
$clientWithOptions = $client->withOptions(['user_data' => 'test']);

$this->assertNotSame($client, $clientWithOptions);
$this->assertSame(\get_class($client), \get_class($clientWithOptions));

$response = $clientWithOptions->request('GET', 'http://server/server/index.php');
$this->assertSame(200, $response->getStatusCode());

// Test that the extra data can be obtained.
$this->assertSame('test', $response->getInfo('user_data'));
}

/**
Expand Down

0 comments on commit aab5494

Please sign in to comment.