Files
listmonk-api-bundle/tests/DependencyInjection/MagdevListmonkApiExtensionTest.php

50 lines
1.7 KiB
PHP
Raw Permalink Normal View History

2025-07-17 12:59:14 +02:00
<?php declare(strict_types=1);
namespace Magdev\RedmineBundle\Tests\DependencyInjection;
use Magdev\ListmonkApi\ListmonkClient;
use Magdev\ListmonkApiBundle\DependencyInjection\MagdevListmonkApiExtension;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpClient\ScopingHttpClient;
use Symfony\Contracts\HttpClient\HttpClientInterface;
/**
* @author Marco Grätsch <magdev3.0@gmail.com>
*/
class MagdevListmonkApiExtensionTest extends TestCase
{
public function testExtension(): void
{
$container = new ContainerBuilder();
(new MagdevListmonkApiExtension())->load([
'magdev_listmonk' => [
'connections' => [
'default' => [
'hostname' => 'https://localhost:8443',
'username' => 'listmonk',
'token' => 'listmonk',
'verify_https' => false,
'options' => [
'logger' => [
'filename' => 'php://stdout',
'level' => 100,
],
],
],
],
],
], $container);
$client = $container->get('magdev.listmonk.default');
/** @var \Magdev\ListmonkApi\ListmonkClient $client */
$this->assertInstanceOf(ListmonkClient::class, $client);
$httpClient = $client->getClient();
/** @var \Symfony\Component\HttpClient\ScopingHttpClient $httpClient */
$this->assertInstanceOf(HttpClientInterface::class, $httpClient);
$this->assertInstanceOf(ScopingHttpClient::class, $httpClient);
}
}