Skip to content

Commit 1274012

Browse files
committed
Added test that reveal error
1 parent 1f28ecc commit 1274012

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/.php_cs.cache
22
/behat.yml
3+
/bin/
34
/build/
45
/composer.lock
56
/phpspec.yml

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"php-http/guzzle6-adapter": "^1.1.1 || ^2.0.1",
5454
"php-http/mock-client": "^1.2",
5555
"php-http/promise": "^1.0",
56+
"phpunit/phpunit": "7.5.*",
5657
"polishsymfonycommunity/symfony-mocker-container": "^1.0",
5758
"symfony/browser-kit": "^3.4.20 || ^4.2.1",
5859
"symfony/cache": "^3.4.20 || ^4.2.1",
@@ -71,7 +72,8 @@
7172
"twig/twig": "Add this to your require-dev section when using the WebProfilerBundle"
7273
},
7374
"config": {
74-
"sort-packages": true
75+
"sort-packages": true,
76+
"bin-dir": "bin"
7577
},
7678
"extra": {
7779
"branch-alias": {

tests/Unit/Collector/ProfileClientTest.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Http\Promise\FulfilledPromise;
1515
use Http\Promise\Promise;
1616
use Http\Promise\RejectedPromise;
17+
use PHPUnit\Framework\MockObject\MockObject;
1718
use PHPUnit\Framework\TestCase;
1819
use Psr\Http\Message\RequestInterface;
1920
use Psr\Http\Message\ResponseInterface;
@@ -34,7 +35,7 @@ class ProfileClientTest extends TestCase
3435
private $activeStack;
3536

3637
/**
37-
* @var HttpClient
38+
* @var HttpClient|MockObject
3839
*/
3940
private $client;
4041

@@ -145,6 +146,16 @@ public function testSendRequest(): void
145146
$this->assertEquals('https', $this->activeStack->getRequestScheme());
146147
}
147148

149+
public function testSendRequestTypeError()
150+
{
151+
$this->client
152+
->expects($this->once())
153+
->method('sendRequest')
154+
->willThrowException(new \TypeError('You set string to int prop'));
155+
156+
$response = $this->subject->sendRequest($this->request);
157+
}
158+
148159
public function testSendAsyncRequest(): void
149160
{
150161
$this->client

0 commit comments

Comments
 (0)