mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 23:59:26 +03:00
b3c53beead
* Add dump command to print out swagger JSON. Command outputs to stdout, so can be redirected to a file. Pretty prints output by default. --no-pretty can be passed to remove whitespace from json output if it does not need to be human readable * Update for styleci corrections * Fix CS and add type hint * REbase + Updates to documentation of dump command. * Remove defaultName - config file specifies this Add return value to dump command * Update for OA3 * Add a test case * update command name * Fix the tests Co-authored-by: Guilhem Niot <egetick@gmail.com> Co-authored-by: Guilhem Niot <guilhem.niot@gmail.com>
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\Command;
|
|
|
|
use Nelmio\ApiDocBundle\Tests\Functional\WebTestCase; // for the creation of the kernel
|
|
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
|
use Symfony\Component\Console\Tester\CommandTester;
|
|
|
|
class DumpCommandTest extends WebTestCase
|
|
{
|
|
public function testExecute()
|
|
{
|
|
$kernel = static::bootKernel();
|
|
$application = new Application($kernel);
|
|
|
|
$command = $application->find('nelmio:apidoc:dump');
|
|
$commandTester = new CommandTester($command);
|
|
$commandTester->execute([
|
|
'--area' => 'test',
|
|
'--no-pretty' => '',
|
|
]);
|
|
|
|
// the output of the command in the console
|
|
$output = $commandTester->getDisplay();
|
|
$this->assertEquals(json_encode($this->getOpenApiDefinition('test'))."\n", $output);
|
|
}
|
|
}
|