mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Fix Declaration must be compatible error with tests (#1638)
* Fix Declaration must be compatible error with tests * Fix phpunit deprecation warnings for @expectedExceptions * Add phpunit.bat for windows users, bump phpunit to version 7.5
This commit is contained in:
parent
b3c53beead
commit
239a26d014
@ -147,11 +147,12 @@ class ConfigurationTest extends TestCase
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage You must not use both `nelmio_api_doc.areas` and `nelmio_api_doc.routes` config options. Please update your config to only use `nelmio_api_doc.areas`.
|
||||
*/
|
||||
public function testBothAreasAndRoutes()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('You must not use both `nelmio_api_doc.areas` and `nelmio_api_doc.routes` config options. Please update your config to only use `nelmio_api_doc.areas`.');
|
||||
|
||||
$processor = new Processor();
|
||||
$config = $processor->processConfiguration(new Configuration(), [['areas' => [], 'routes' => []]]);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ class ApiPlatformDescriberTest extends AbstractDescriberTest
|
||||
$this->assertEquals($expectedApi->toJson(), $this->getOpenApiDoc()->toJson());
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->documentation = new Documentation(new ResourceNameCollection(['dummy' => 'dummy']));
|
||||
|
||||
|
@ -35,7 +35,7 @@ class RouteDescriberTest extends AbstractDescriberTest
|
||||
$this->assertEquals((new OpenApi([]))->toJson(), $this->getOpenApiDoc()->toJson());
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->routeDescriber = $this->createMock(RouteDescriberInterface::class);
|
||||
$this->routes = new RouteCollection();
|
||||
|
@ -15,7 +15,7 @@ use Hateoas\Configuration\Embedded;
|
||||
|
||||
class BazingaFunctionalTest extends WebTestCase
|
||||
{
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -16,7 +16,7 @@ use OpenApi\Annotations as OA;
|
||||
|
||||
class FOSRestTest extends WebTestCase
|
||||
{
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -17,7 +17,7 @@ use Symfony\Component\Serializer\Annotation\SerializedName;
|
||||
|
||||
class FunctionalTest extends WebTestCase
|
||||
{
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -13,7 +13,7 @@ namespace Nelmio\ApiDocBundle\Tests\Functional;
|
||||
|
||||
class JMSFunctionalTest extends WebTestCase
|
||||
{
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -20,7 +20,7 @@ class SwaggerUiTest extends WebTestCase
|
||||
*/
|
||||
private $client;
|
||||
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -19,6 +19,7 @@ use Nelmio\ApiDocBundle\Util\ControllerReflector;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser;
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
use Symfony\Component\OptionsResolver\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Routing\Route;
|
||||
use Symfony\Component\Routing\RouteCollection;
|
||||
|
||||
@ -84,12 +85,12 @@ class FilteredRouteCollectionBuilderTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidArgumentException
|
||||
*
|
||||
* @dataProvider getInvalidOptions
|
||||
*/
|
||||
public function testFilterWithInvalidOption(array $options)
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
|
||||
new FilteredRouteCollectionBuilder(
|
||||
new AnnotationReader(),
|
||||
$this->createControllerReflector(),
|
||||
|
@ -46,7 +46,7 @@ class UtilTest extends TestCase
|
||||
/** @var OA\OpenApi */
|
||||
public $rootAnnotation;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
2
phpunit
2
phpunit
@ -5,5 +5,5 @@ if (!file_exists(__DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
|
||||
exit(1);
|
||||
}
|
||||
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
|
||||
putenv('SYMFONY_PHPUNIT_VERSION=6.5');
|
||||
putenv('SYMFONY_PHPUNIT_VERSION=7.5');
|
||||
require __DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit';
|
||||
|
2
phpunit.bat
Normal file
2
phpunit.bat
Normal file
@ -0,0 +1,2 @@
|
||||
@ECHO OFF
|
||||
php "%~dp0phpunit" %*
|
Loading…
x
Reference in New Issue
Block a user