mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 23:59:26 +03:00
7de49bb4a8
* add null check https://github.com/nelmio/NelmioApiDocBundle/issues/1909 * less code is better * add tests for ControllerReflection::getReflectionMethod() * lint fix * style_ci fixes Co-authored-by: Alexey <alshenestky@icloud.com>
30 lines
1.0 KiB
PHP
30 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace Nelmio\ApiDocBundle\Tests\Util;
|
|
|
|
use Nelmio\ApiDocBundle\Tests\Functional\Controller\BazingaController;
|
|
use Nelmio\ApiDocBundle\Util\ControllerReflector;
|
|
use PHPUnit\Framework\TestCase;
|
|
use ReflectionMethod;
|
|
use Symfony\Component\DependencyInjection\Container;
|
|
|
|
class ControllerReflectorTest extends TestCase
|
|
{
|
|
public function testGetReflectionMethod(): void
|
|
{
|
|
$controllerReflector = new ControllerReflector(new Container());
|
|
$this->assertEquals(
|
|
ReflectionMethod::class,
|
|
get_class($controllerReflector->getReflectionMethod([BazingaController::class, 'userAction']))
|
|
);
|
|
$this->assertEquals(
|
|
ReflectionMethod::class,
|
|
get_class($controllerReflector->getReflectionMethod(BazingaController::class.'::userAction'))
|
|
);
|
|
$this->assertNull(
|
|
$controllerReflector->getReflectionMethod('UnknownController::userAction')
|
|
);
|
|
$this->assertNull($controllerReflector->getReflectionMethod(null));
|
|
}
|
|
}
|