Skip to content

Commit

Permalink
bump mt
Browse files Browse the repository at this point in the history
  • Loading branch information
rodber committed Aug 10, 2023
1 parent 604738c commit e2b62c3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/Interfaces/CurlInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
*/
interface CurlInterface
{
public function handle(): CurlHandle;
public function __destruct();

public function handle(): ?CurlHandle;

public function error(): string;

Expand Down
6 changes: 3 additions & 3 deletions src/Traits/CurlTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ public function __destruct()
}
}

public function handle(): CurlHandle
public function handle(): ?CurlHandle
{
return $this->handle;
return isset($this->handle) ? $this->handle : null;
}

public function error(): string
Expand All @@ -73,7 +73,7 @@ public function setOptArray(array $options): bool

public function close(): void
{
curl_close($this->handle);
unset($this->handle);
}

private function assertCurl(): void
Expand Down
6 changes: 6 additions & 0 deletions tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ public function testPost(): void
CURLOPT_USERAGENT => 'chevere/xr 1.0',
];
$this->assertSame($options, $client->options());
$curl = $this->createMock(Curl::class);
$curl->expects($this->once())
->method('setOptArray')
->with($options);
$client = $client->withCurl($curl);
$client->sendMessage($message);
}

public function testCustom(): void
Expand Down

0 comments on commit e2b62c3

Please sign in to comment.