2021-02-05 14:47:54 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace RetailCrm\ServiceBundle\Tests\DependencyInjection;
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
use RetailCrm\ServiceBundle\ArgumentResolver\CallbackValueResolver;
|
|
|
|
use RetailCrm\ServiceBundle\ArgumentResolver\ClientValueResolver;
|
|
|
|
use RetailCrm\ServiceBundle\DependencyInjection\RetailCrmServiceExtension;
|
|
|
|
use RetailCrm\ServiceBundle\Response\ErrorJsonResponseFactory;
|
|
|
|
use RetailCrm\ServiceBundle\Security\CallbackClientAuthenticator;
|
|
|
|
use RetailCrm\ServiceBundle\Security\FrontApiClientAuthenticator;
|
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|
|
|
use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;
|
|
|
|
|
|
|
|
class RetailCrmServiceExtensionTest extends TestCase
|
|
|
|
{
|
|
|
|
private $container;
|
|
|
|
|
|
|
|
protected function setUp(): void
|
|
|
|
{
|
|
|
|
$container = new ContainerBuilder(new EnvPlaceholderParameterBag());
|
|
|
|
$container->getCompilerPassConfig()->setOptimizationPasses([]);
|
|
|
|
$container->getCompilerPassConfig()->setRemovingPasses([]);
|
|
|
|
|
|
|
|
$extension = new RetailCrmServiceExtension();
|
|
|
|
$extension->load(
|
|
|
|
[
|
|
|
|
[
|
2021-02-17 09:31:36 +03:00
|
|
|
'request_schema' => [
|
|
|
|
'callback' => [],
|
|
|
|
'client' => []
|
2021-03-31 11:00:48 +03:00
|
|
|
],
|
|
|
|
'messenger' => [
|
|
|
|
'message_handler' => 'simple_console_runner'
|
2021-02-17 09:31:36 +03:00
|
|
|
]
|
2021-02-05 14:47:54 +03:00
|
|
|
]
|
|
|
|
],
|
|
|
|
$container
|
|
|
|
);
|
|
|
|
|
|
|
|
$container->compile();
|
|
|
|
|
|
|
|
$this->container = $container;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testLoad(): void
|
|
|
|
{
|
2021-02-17 09:31:36 +03:00
|
|
|
static::assertTrue($this->container->hasParameter('retail_crm_service.request_schema.callback.supports'));
|
|
|
|
static::assertTrue($this->container->hasParameter('retail_crm_service.request_schema.callback.serializer'));
|
|
|
|
static::assertTrue($this->container->hasParameter('retail_crm_service.request_schema.client.supports'));
|
|
|
|
static::assertTrue($this->container->hasParameter('retail_crm_service.request_schema.client.serializer'));
|
2021-02-05 14:47:54 +03:00
|
|
|
static::assertTrue($this->container->hasDefinition(CallbackValueResolver::class));
|
|
|
|
static::assertTrue($this->container->hasDefinition(ClientValueResolver::class));
|
|
|
|
static::assertTrue($this->container->hasDefinition(ErrorJsonResponseFactory::class));
|
|
|
|
static::assertTrue($this->container->hasDefinition(CallbackClientAuthenticator::class));
|
|
|
|
static::assertTrue($this->container->hasDefinition(FrontApiClientAuthenticator::class));
|
|
|
|
}
|
|
|
|
}
|