mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-03 08:09:25 +03:00
86 lines
2.6 KiB
PHP
86 lines
2.6 KiB
PHP
|
<?php
|
||
|
|
||
|
/*
|
||
|
* This file is part of the NelmioApiDocBundle package.
|
||
|
*
|
||
|
* (c) Nelmio
|
||
|
*
|
||
|
* For the full copyright and license information, please view the LICENSE
|
||
|
* file that was distributed with this source code.
|
||
|
*/
|
||
|
|
||
|
namespace Nelmio\ApiDocBundle\Tests\Describer;
|
||
|
|
||
|
use Nelmio\ApiDocBundle\DependencyInjection\NelmioApiDocExtension;
|
||
|
use PHPUnit\Framework\TestCase;
|
||
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||
|
|
||
|
class NelmioApiDocExtensionTest extends TestCase
|
||
|
{
|
||
|
public function testMergesRootKeysFromMultipleConfigurations()
|
||
|
{
|
||
|
$container = new ContainerBuilder();
|
||
|
$container->setParameter('kernel.bundles', []);
|
||
|
$extension = new NelmioApiDocExtension();
|
||
|
$extension->load([
|
||
|
[
|
||
|
'documentation' => [
|
||
|
'info' => [
|
||
|
'title' => 'API documentation',
|
||
|
'description' => 'This is the api documentation, use it wisely',
|
||
|
],
|
||
|
],
|
||
|
],
|
||
|
[
|
||
|
'documentation' => [
|
||
|
'tags' => [
|
||
|
[
|
||
|
'name' => 'secured',
|
||
|
'description' => 'Requires authentication',
|
||
|
],
|
||
|
[
|
||
|
'name' => 'another',
|
||
|
'description' => 'Another tag serving another purpose',
|
||
|
],
|
||
|
],
|
||
|
],
|
||
|
],
|
||
|
[
|
||
|
'documentation' => [
|
||
|
'paths' => [
|
||
|
'/api/v1/model' => [
|
||
|
'get' => [
|
||
|
'tags' => ['secured'],
|
||
|
],
|
||
|
],
|
||
|
],
|
||
|
],
|
||
|
],
|
||
|
], $container);
|
||
|
|
||
|
$this->assertSame([
|
||
|
'info' => [
|
||
|
'title' => 'API documentation',
|
||
|
'description' => 'This is the api documentation, use it wisely',
|
||
|
],
|
||
|
'tags' => [
|
||
|
[
|
||
|
'name' => 'secured',
|
||
|
'description' => 'Requires authentication',
|
||
|
],
|
||
|
[
|
||
|
'name' => 'another',
|
||
|
'description' => 'Another tag serving another purpose',
|
||
|
],
|
||
|
],
|
||
|
'paths' => [
|
||
|
'/api/v1/model' => [
|
||
|
'get' => [
|
||
|
'tags' => ['secured'],
|
||
|
],
|
||
|
],
|
||
|
],
|
||
|
], $container->getDefinition('nelmio_api_doc.describers.config')->getArgument(0));
|
||
|
}
|
||
|
}
|