2017-08-08 19:32:53 +02:00
|
|
|
<?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.
|
|
|
|
*/
|
|
|
|
|
2018-01-04 14:33:02 +01:00
|
|
|
namespace Nelmio\ApiDocBundle\Tests\DependencyInjection;
|
2017-08-08 19:32:53 +02:00
|
|
|
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
}
|