Completed
Push — master ( b587fb...d05392 )
by David
20:34
created

Issue206::testCustomClientDoesNotCauseException()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Http\HttplugBundle\Tests\Functional;
6
7
use Http\Client\Common\HttpMethodsClient;
8
use Http\Client\Common\PluginClient;
9
use Http\Client\Common\PluginClientFactory;
10
use Http\Discovery\HttpClientDiscovery;
11
use Http\Discovery\MessageFactoryDiscovery;
12
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
13
14
class Issue206 extends WebTestCase
15
{
16
    public function testCustomClientDoesNotCauseException()
17
    {
18
        static::bootKernel();
19
        $container = static::$kernel->getContainer();
20
        PluginClientFactory::setFactory([$container->get('Http\Client\Common\PluginClientFactory'), 'createClient']);
21
22
        // Create a client
23
        $myCustomClient = new HttpMethodsClient(HttpClientDiscovery::find(), MessageFactoryDiscovery::find());
24
        $pluginClient = (new PluginClientFactory())->createClient($myCustomClient, []);
25
26
        // If we get to this line, no exceptions has been thrown.
27
        $this->assertInstanceOf(PluginClient::class, $pluginClient);
28
    }
29
}
30