mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Add php 8 support (#1745)
* Add php 8 support * Ignore platform reqs * Change php constraint * Use vendor/bin/simple-phpunit directly * Remove willdurand/hateoas-bundle when testing php8 * Merge 3.x * Move to github actions * Fix the tests * Change ./phpunit permissions * Update deprecations policy
This commit is contained in:
parent
67b28f1f7f
commit
6d995a6e03
64
.github/workflows/continuous-integration.yml
vendored
Normal file
64
.github/workflows/continuous-integration.yml
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
# from doctrine/instantiator:
|
||||
# https://github.com/doctrine/instantiator/blob/97aa11bb71ad6259a8c5a1161b4de2d6cdcc5501/.github/workflows/continuous-integration.yml
|
||||
|
||||
name: "CI"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- "*.x"
|
||||
push:
|
||||
branches:
|
||||
- "*.x"
|
||||
|
||||
env:
|
||||
fail-fast: true
|
||||
COMPOSER_ROOT_VERSION: "1.4"
|
||||
|
||||
jobs:
|
||||
phpunit:
|
||||
name: "PHPUnit"
|
||||
runs-on: "ubuntu-20.04"
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- php-version: 7.1
|
||||
composer-flags: "--prefer-lowest"
|
||||
- php-version: 7.2
|
||||
symfony-require: "3.4.*"
|
||||
- php-version: 7.3
|
||||
symfony-require: "4.4.*"
|
||||
- php-version: 7.3
|
||||
symfony-require: "^5.0"
|
||||
- php-version: 8.0
|
||||
composer-flags: "--ignore-platform-reqs"
|
||||
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: "actions/checkout@v2"
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: "Install PHP without coverage"
|
||||
uses: "shivammathur/setup-php@v2"
|
||||
with:
|
||||
php-version: "${{ matrix.php-version }}"
|
||||
coverage: "none"
|
||||
|
||||
- name: "Cache dependencies installed with composer"
|
||||
uses: "actions/cache@v2"
|
||||
with:
|
||||
path: "~/.composer/cache"
|
||||
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
|
||||
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"
|
||||
|
||||
- name: "Install dependencies with composer"
|
||||
env:
|
||||
SYMFONY_REQUIRE: "${{ matrix.symfony-require }}"
|
||||
run: |
|
||||
composer global require --no-progress --no-scripts --no-plugins symfony/flex
|
||||
composer update --no-interaction --no-progress ${{ matrix.composer-flags }}
|
||||
|
||||
- name: "Run PHPUnit"
|
||||
run: "./phpunit"
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,5 +6,6 @@
|
||||
/.php_cs
|
||||
/phpunit.xml
|
||||
/.phpunit
|
||||
/.phpunit.result.cache
|
||||
/Tests/Functional/cache
|
||||
/Tests/Functional/logs
|
||||
|
38
.travis.yml
38
.travis.yml
@ -1,38 +0,0 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 7.1
|
||||
- 7.2
|
||||
- 7.3
|
||||
- 7.4
|
||||
|
||||
sudo: false
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- .phpunit
|
||||
- $HOME/.composer/cache
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- php: 7.1
|
||||
env: COMPOSER_FLAGS="--prefer-lowest"
|
||||
- php: 7.2
|
||||
env: SYMFONY_VERSION=^3.4
|
||||
- php: 7.3
|
||||
env: SYMFONY_VERSION=^4.0
|
||||
- php: 7.3
|
||||
env: SYMFONY_VERSION=^5.0
|
||||
- php: 7.4
|
||||
env: SYMFONY_VERSION=^4.0
|
||||
- php: 7.4
|
||||
env: SYMFONY_VERSION=^5.0
|
||||
|
||||
before_install:
|
||||
- phpenv config-rm xdebug.ini || true
|
||||
- if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --dev --no-update; fi;
|
||||
|
||||
install: composer update --no-interaction $COMPOSER_FLAGS
|
||||
|
||||
script: ./phpunit
|
@ -11,7 +11,7 @@ You MUST follow the [PSR-1](http://www.php-fig.org/psr/psr-1/) and
|
||||
should really read the recommendations. Can't wait? Use the [PHP-CS-Fixer
|
||||
tool](http://cs.sensiolabs.org/).
|
||||
|
||||
You MUST run the test suite.
|
||||
You MUST run the test suite (run `composer update`, and then execute `vendor/bin/simple-phpunit`).
|
||||
|
||||
You MUST write (or update) unit tests.
|
||||
|
||||
|
@ -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' => []]]);
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class RouteDescriberTest extends AbstractDescriberTest
|
||||
$this->assertEquals((new Swagger())->toArray(), $this->getSwaggerDoc()->toArray());
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->routeDescriber = $this->createMock(RouteDescriberInterface::class);
|
||||
$this->routes = new RouteCollection();
|
||||
|
@ -15,7 +15,7 @@ use Nelmio\ApiDocBundle\Exception\UndocumentedArrayItemsException;
|
||||
|
||||
class ArrayItemsErrorTest extends WebTestCase
|
||||
{
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -15,7 +15,7 @@ use Hateoas\Configuration\Embedded;
|
||||
|
||||
class BazingaFunctionalTest extends WebTestCase
|
||||
{
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -13,7 +13,7 @@ namespace Nelmio\ApiDocBundle\Tests\Functional;
|
||||
|
||||
class FOSRestTest extends WebTestCase
|
||||
{
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -16,7 +16,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();
|
||||
|
||||
|
@ -84,12 +84,12 @@ class FilteredRouteCollectionBuilderTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidArgumentException
|
||||
*
|
||||
* @dataProvider getInvalidOptions
|
||||
*/
|
||||
public function testFilterWithInvalidOption(array $options)
|
||||
{
|
||||
$this->expectException(\Symfony\Component\OptionsResolver\Exception\InvalidArgumentException::class);
|
||||
|
||||
new FilteredRouteCollectionBuilder(
|
||||
new AnnotationReader(),
|
||||
$this->createControllerReflector(),
|
||||
|
@ -15,7 +15,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.1",
|
||||
"php": ">=7.1.3",
|
||||
"symfony/framework-bundle": "^3.4|^4.0|^5.0",
|
||||
"symfony/options-resolver": "^3.4.4|^4.0|^5.0",
|
||||
"symfony/property-info": "^3.4|^4.0|^5.0",
|
||||
@ -30,6 +30,7 @@
|
||||
"symfony/console": "^3.4|^4.0|^5.0",
|
||||
"symfony/config": "^3.4|^4.0|^5.0",
|
||||
"symfony/validator": "^3.4|^4.0|^5.0",
|
||||
"symfony/expression-language": "^3.4|^4.0|^5.0",
|
||||
"symfony/property-access": "^3.4|^4.0|^5.0",
|
||||
"symfony/form": "^3.4|^4.0|^5.0",
|
||||
"symfony/dom-crawler": "^3.4|^4.0|^5.0",
|
||||
@ -43,7 +44,7 @@
|
||||
"doctrine/common": "^2.4",
|
||||
|
||||
"api-platform/core": "^2.1.2",
|
||||
"friendsofsymfony/rest-bundle": "^2.0|^3.0@beta",
|
||||
"friendsofsymfony/rest-bundle": "^2.0|^3.0@dev",
|
||||
"willdurand/hateoas-bundle": "^1.0|^2.0",
|
||||
"jms/serializer-bundle": "^2.3|^3.0",
|
||||
"jms/serializer": "^1.14|^3.0"
|
||||
|
Loading…
x
Reference in New Issue
Block a user