mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 23:59:26 +03:00
7d9573ddf6
* Move the OpenApi processing to ApiDocGenerator * Temporary fix for https://github.com/zircote/swagger-php/pull/791 * Stop using the ModelRegistry in OpenApiPhpDescriber
37 lines
1.0 KiB
PHP
37 lines
1.0 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;
|
|
|
|
use Nelmio\ApiDocBundle\ApiDocGenerator;
|
|
use Nelmio\ApiDocBundle\Describer\DefaultDescriber;
|
|
use PHPUnit\Framework\TestCase;
|
|
use Symfony\Component\Cache\Adapter\ArrayAdapter;
|
|
|
|
class ApiDocGeneratorTest extends TestCase
|
|
{
|
|
public function testCache()
|
|
{
|
|
$adapter = new ArrayAdapter();
|
|
$generator = new ApiDocGenerator([new DefaultDescriber()], [], $adapter);
|
|
|
|
$this->assertEquals(json_encode($generator->generate()), json_encode($adapter->getItem('openapi_doc')->get()));
|
|
}
|
|
|
|
public function testCacheWithCustomId()
|
|
{
|
|
$adapter = new ArrayAdapter();
|
|
$generator = new ApiDocGenerator([new DefaultDescriber()], [], $adapter, 'custom_id');
|
|
|
|
$this->assertEquals(json_encode($generator->generate()), json_encode($adapter->getItem('custom_id')->get()));
|
|
}
|
|
}
|