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

Issue206   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 6
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testCustomClientDoesNotCauseException() 0 13 1
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