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