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:
Mantis Development 2020-05-31 14:16:51 +01:00 committed by GitHub
parent b3c53beead
commit 239a26d014
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 17 additions and 13 deletions

View File

@ -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' => []]]);
}

View File

@ -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']));

View File

@ -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();

View File

@ -15,7 +15,7 @@ use Hateoas\Configuration\Embedded;
class BazingaFunctionalTest extends WebTestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();

View File

@ -16,7 +16,7 @@ use OpenApi\Annotations as OA;
class FOSRestTest extends WebTestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();

View File

@ -17,7 +17,7 @@ use Symfony\Component\Serializer\Annotation\SerializedName;
class FunctionalTest extends WebTestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();

View File

@ -13,7 +13,7 @@ namespace Nelmio\ApiDocBundle\Tests\Functional;
class JMSFunctionalTest extends WebTestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();

View File

@ -20,7 +20,7 @@ class SwaggerUiTest extends WebTestCase
*/
private $client;
protected function setUp()
protected function setUp(): void
{
parent::setUp();

View File

@ -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(),

View File

@ -46,7 +46,7 @@ class UtilTest extends TestCase
/** @var OA\OpenApi */
public $rootAnnotation;
public function setUp()
public function setUp(): void
{
parent::setUp();

View File

@ -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
View File

@ -0,0 +1,2 @@
@ECHO OFF
php "%~dp0phpunit" %*