[php-symfony] Symfony6 support (#11810)

* support symfony6

* fix issues with StrictJsonDeserialization

* regenerate samples

* add suggestions

* update samples

* support php 7.4 and symfony 5

* allow versions based on semantic versioning

* regenerate sample

* change method of determining result types

* update samples

* describe usage of bundle in symfony app

* better documentation

* fix duplicate auth methods

* do not set namespace for default types

* fix UploadedFile type

* next try fixing auth

* regenerate samples

* fix: auth method shall not be duplicated

* Revert "fix duplicate auth methods"

This reverts commit 0dc418737b.

* chore: regenerate samples

* fix tests

* regenerate sample

* more fixes for tests

* update tests

* add kernel shutdown

Co-authored-by: Benjamin Haeublein <benjaminh@testing-vm.lan.benjaminh.de>
Co-authored-by: Renaud de Chivré <renaud@tahitiwebdesign.com>
This commit is contained in:
Benjamin Häublein
2022-05-25 09:34:50 +02:00
committed by GitHub
parent 96dd6c5806
commit 77fa028bb3
70 changed files with 603 additions and 776 deletions

View File

@@ -1,7 +1,7 @@
<?php
/**
* PetApiInterfaceTest
* PHP version 7.1.3
* PHP version 8.1.1
*
* @category Class
* @package OpenAPI\Server\Tests\Api
@@ -32,6 +32,7 @@ use OpenAPI\Server\Configuration;
use OpenAPI\Server\ApiClient;
use OpenAPI\Server\ApiException;
use OpenAPI\Server\ObjectSerializer;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/**
@@ -44,32 +45,37 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
*/
class PetApiInterfaceTest extends WebTestCase
{
private static ?KernelBrowser $client = null;
/**
* Setup before running any test cases
*/
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
}
/**
* Setup before running each test case
*/
public function setUp()
public function setUp(): void
{
if (null === self::$client) {
self::$client = static::createClient();
}
}
/**
* Clean up after running each test case
*/
public function tearDown()
public function tearDown(): void
{
static::ensureKernelShutdown();
}
/**
* Clean up after running all test cases
*/
public static function tearDownAfterClass()
public static function tearDownAfterClass(): void
{
}
@@ -81,7 +87,7 @@ class PetApiInterfaceTest extends WebTestCase
*/
public function testAddPet()
{
$client = static::createClient();
$client = self::$client;
$path = '/pet';
@@ -96,7 +102,7 @@ class PetApiInterfaceTest extends WebTestCase
*/
public function testDeletePet()
{
$client = static::createClient();
$client = self::$client;
$path = '/pet/{petId}';
$pattern = '{petId}';
@@ -114,7 +120,7 @@ class PetApiInterfaceTest extends WebTestCase
*/
public function testFindPetsByStatus()
{
$client = static::createClient();
$client = self::$client;
$path = '/pet/findByStatus';
@@ -129,7 +135,7 @@ class PetApiInterfaceTest extends WebTestCase
*/
public function testFindPetsByTags()
{
$client = static::createClient();
$client = self::$client;
$path = '/pet/findByTags';
@@ -144,7 +150,7 @@ class PetApiInterfaceTest extends WebTestCase
*/
public function testGetPetById()
{
$client = static::createClient();
$client = self::$client;
$path = '/pet/{petId}';
$pattern = '{petId}';
@@ -162,7 +168,7 @@ class PetApiInterfaceTest extends WebTestCase
*/
public function testUpdatePet()
{
$client = static::createClient();
$client = self::$client;
$path = '/pet';
@@ -177,7 +183,7 @@ class PetApiInterfaceTest extends WebTestCase
*/
public function testUpdatePetWithForm()
{
$client = static::createClient();
$client = self::$client;
$path = '/pet/{petId}';
$pattern = '{petId}';
@@ -195,7 +201,7 @@ class PetApiInterfaceTest extends WebTestCase
*/
public function testUploadFile()
{
$client = static::createClient();
$client = self::$client;
$path = '/pet/{petId}/uploadImage';
$pattern = '{petId}';
@@ -212,6 +218,6 @@ class PetApiInterfaceTest extends WebTestCase
$ast = $compiler->parse($regexp);
$generator = new \Hoa\Regex\Visitor\Isotropic(new \Hoa\Math\Sampler\Random());
return $generator->visit($ast);
return $generator->visit($ast);
}
}

View File

@@ -1,7 +1,7 @@
<?php
/**
* StoreApiInterfaceTest
* PHP version 7.1.3
* PHP version 8.1.1
*
* @category Class
* @package OpenAPI\Server\Tests\Api
@@ -32,6 +32,7 @@ use OpenAPI\Server\Configuration;
use OpenAPI\Server\ApiClient;
use OpenAPI\Server\ApiException;
use OpenAPI\Server\ObjectSerializer;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/**
@@ -44,32 +45,37 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
*/
class StoreApiInterfaceTest extends WebTestCase
{
private static ?KernelBrowser $client = null;
/**
* Setup before running any test cases
*/
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
}
/**
* Setup before running each test case
*/
public function setUp()
public function setUp(): void
{
if (null === self::$client) {
self::$client = static::createClient();
}
}
/**
* Clean up after running each test case
*/
public function tearDown()
public function tearDown(): void
{
static::ensureKernelShutdown();
}
/**
* Clean up after running all test cases
*/
public static function tearDownAfterClass()
public static function tearDownAfterClass(): void
{
}
@@ -81,7 +87,7 @@ class StoreApiInterfaceTest extends WebTestCase
*/
public function testDeleteOrder()
{
$client = static::createClient();
$client = self::$client;
$path = '/store/order/{orderId}';
$pattern = '{orderId}';
@@ -99,7 +105,7 @@ class StoreApiInterfaceTest extends WebTestCase
*/
public function testGetInventory()
{
$client = static::createClient();
$client = self::$client;
$path = '/store/inventory';
@@ -114,7 +120,7 @@ class StoreApiInterfaceTest extends WebTestCase
*/
public function testGetOrderById()
{
$client = static::createClient();
$client = self::$client;
$path = '/store/order/{orderId}';
$pattern = '{orderId}';
@@ -132,7 +138,7 @@ class StoreApiInterfaceTest extends WebTestCase
*/
public function testPlaceOrder()
{
$client = static::createClient();
$client = self::$client;
$path = '/store/order';
@@ -146,6 +152,6 @@ class StoreApiInterfaceTest extends WebTestCase
$ast = $compiler->parse($regexp);
$generator = new \Hoa\Regex\Visitor\Isotropic(new \Hoa\Math\Sampler\Random());
return $generator->visit($ast);
return $generator->visit($ast);
}
}

View File

@@ -1,7 +1,7 @@
<?php
/**
* UserApiInterfaceTest
* PHP version 7.1.3
* PHP version 8.1.1
*
* @category Class
* @package OpenAPI\Server\Tests\Api
@@ -32,6 +32,7 @@ use OpenAPI\Server\Configuration;
use OpenAPI\Server\ApiClient;
use OpenAPI\Server\ApiException;
use OpenAPI\Server\ObjectSerializer;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/**
@@ -44,32 +45,37 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
*/
class UserApiInterfaceTest extends WebTestCase
{
private static ?KernelBrowser $client = null;
/**
* Setup before running any test cases
*/
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
}
/**
* Setup before running each test case
*/
public function setUp()
public function setUp(): void
{
if (null === self::$client) {
self::$client = static::createClient();
}
}
/**
* Clean up after running each test case
*/
public function tearDown()
public function tearDown(): void
{
static::ensureKernelShutdown();
}
/**
* Clean up after running all test cases
*/
public static function tearDownAfterClass()
public static function tearDownAfterClass(): void
{
}
@@ -81,7 +87,7 @@ class UserApiInterfaceTest extends WebTestCase
*/
public function testCreateUser()
{
$client = static::createClient();
$client = self::$client;
$path = '/user';
@@ -96,7 +102,7 @@ class UserApiInterfaceTest extends WebTestCase
*/
public function testCreateUsersWithArrayInput()
{
$client = static::createClient();
$client = self::$client;
$path = '/user/createWithArray';
@@ -111,7 +117,7 @@ class UserApiInterfaceTest extends WebTestCase
*/
public function testCreateUsersWithListInput()
{
$client = static::createClient();
$client = self::$client;
$path = '/user/createWithList';
@@ -126,7 +132,7 @@ class UserApiInterfaceTest extends WebTestCase
*/
public function testDeleteUser()
{
$client = static::createClient();
$client = self::$client;
$path = '/user/{username}';
$pattern = '{username}';
@@ -144,7 +150,7 @@ class UserApiInterfaceTest extends WebTestCase
*/
public function testGetUserByName()
{
$client = static::createClient();
$client = self::$client;
$path = '/user/{username}';
$pattern = '{username}';
@@ -162,7 +168,7 @@ class UserApiInterfaceTest extends WebTestCase
*/
public function testLoginUser()
{
$client = static::createClient();
$client = self::$client;
$path = '/user/login';
@@ -177,7 +183,7 @@ class UserApiInterfaceTest extends WebTestCase
*/
public function testLogoutUser()
{
$client = static::createClient();
$client = self::$client;
$path = '/user/logout';
@@ -192,7 +198,7 @@ class UserApiInterfaceTest extends WebTestCase
*/
public function testUpdateUser()
{
$client = static::createClient();
$client = self::$client;
$path = '/user/{username}';
$pattern = '{username}';
@@ -209,6 +215,6 @@ class UserApiInterfaceTest extends WebTestCase
$ast = $compiler->parse($regexp);
$generator = new \Hoa\Regex\Visitor\Isotropic(new \Hoa\Math\Sampler\Random());
return $generator->visit($ast);
return $generator->visit($ast);
}
}

View File

@@ -8,7 +8,7 @@ use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
public function registerBundles(): iterable
{
$bundles = array(
new FrameworkBundle()

View File

@@ -1,7 +1,7 @@
<?php
/**
* ControllerTest
* PHP version 7.1.3
* PHP version 8.1.1
*
* @category Class
* @package OpenAPI\Server\Tests\Controller

View File

@@ -2,7 +2,7 @@
/**
* ApiResponseTest
*
* PHP version 7.1.3
* PHP version 8.1.1
*
* @category Class
* @package OpenAPI\Server\Tests\Model
@@ -47,28 +47,28 @@ class ApiResponseTest extends TestCase
/**
* Setup before running any test case
*/
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
}
/**
* Setup before running each test case
*/
public function setUp()
public function setUp(): void
{
}
/**
* Clean up after running each test case
*/
public function tearDown()
public function tearDown(): void
{
}
/**
* Clean up after running all test cases
*/
public static function tearDownAfterClass()
public static function tearDownAfterClass(): void
{
}

View File

@@ -2,7 +2,7 @@
/**
* CategoryTest
*
* PHP version 7.1.3
* PHP version 8.1.1
*
* @category Class
* @package OpenAPI\Server\Tests\Model
@@ -47,28 +47,28 @@ class CategoryTest extends TestCase
/**
* Setup before running any test case
*/
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
}
/**
* Setup before running each test case
*/
public function setUp()
public function setUp(): void
{
}
/**
* Clean up after running each test case
*/
public function tearDown()
public function tearDown(): void
{
}
/**
* Clean up after running all test cases
*/
public static function tearDownAfterClass()
public static function tearDownAfterClass(): void
{
}

View File

@@ -1,96 +0,0 @@
<?php
/**
* InlineObject1Test
*
* PHP version 7.1.3
*
* @category Class
* @package OpenAPI\Server\Tests\Model
* @author openapi-generator contributors
* @link https://github.com/openapitools/openapi-generator
*/
/**
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*
*/
/**
* NOTE: This class is auto generated by the openapi generator program.
* https://github.com/openapitools/openapi-generator
* Please update the test case below to test the model.
*/
namespace OpenAPI\Server\Model;
use PHPUnit\Framework\TestCase;
/**
* InlineObject1Test Class Doc Comment
*
* @category Class */
// * @description InlineObject1
/**
* @package OpenAPI\Server\Tests\Model
* @author openapi-generator contributors
* @link https://github.com/openapitools/openapi-generator
*/
class InlineObject1Test extends TestCase
{
/**
* Setup before running any test case
*/
public static function setUpBeforeClass()
{
}
/**
* Setup before running each test case
*/
public function setUp()
{
}
/**
* Clean up after running each test case
*/
public function tearDown()
{
}
/**
* Clean up after running all test cases
*/
public static function tearDownAfterClass()
{
}
/**
* Test "InlineObject1"
*/
public function testInlineObject1()
{
$testInlineObject1 = new InlineObject1();
}
/**
* Test attribute "additionalMetadata"
*/
public function testPropertyAdditionalMetadata()
{
}
/**
* Test attribute "file"
*/
public function testPropertyFile()
{
}
}

View File

@@ -1,96 +0,0 @@
<?php
/**
* InlineObjectTest
*
* PHP version 7.1.3
*
* @category Class
* @package OpenAPI\Server\Tests\Model
* @author openapi-generator contributors
* @link https://github.com/openapitools/openapi-generator
*/
/**
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*
*/
/**
* NOTE: This class is auto generated by the openapi generator program.
* https://github.com/openapitools/openapi-generator
* Please update the test case below to test the model.
*/
namespace OpenAPI\Server\Model;
use PHPUnit\Framework\TestCase;
/**
* InlineObjectTest Class Doc Comment
*
* @category Class */
// * @description InlineObject
/**
* @package OpenAPI\Server\Tests\Model
* @author openapi-generator contributors
* @link https://github.com/openapitools/openapi-generator
*/
class InlineObjectTest extends TestCase
{
/**
* Setup before running any test case
*/
public static function setUpBeforeClass()
{
}
/**
* Setup before running each test case
*/
public function setUp()
{
}
/**
* Clean up after running each test case
*/
public function tearDown()
{
}
/**
* Clean up after running all test cases
*/
public static function tearDownAfterClass()
{
}
/**
* Test "InlineObject"
*/
public function testInlineObject()
{
$testInlineObject = new InlineObject();
}
/**
* Test attribute "name"
*/
public function testPropertyName()
{
}
/**
* Test attribute "status"
*/
public function testPropertyStatus()
{
}
}

View File

@@ -2,7 +2,7 @@
/**
* OrderTest
*
* PHP version 7.1.3
* PHP version 8.1.1
*
* @category Class
* @package OpenAPI\Server\Tests\Model
@@ -47,28 +47,28 @@ class OrderTest extends TestCase
/**
* Setup before running any test case
*/
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
}
/**
* Setup before running each test case
*/
public function setUp()
public function setUp(): void
{
}
/**
* Clean up after running each test case
*/
public function tearDown()
public function tearDown(): void
{
}
/**
* Clean up after running all test cases
*/
public static function tearDownAfterClass()
public static function tearDownAfterClass(): void
{
}

View File

@@ -2,7 +2,7 @@
/**
* PetTest
*
* PHP version 7.1.3
* PHP version 8.1.1
*
* @category Class
* @package OpenAPI\Server\Tests\Model
@@ -47,28 +47,28 @@ class PetTest extends TestCase
/**
* Setup before running any test case
*/
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
}
/**
* Setup before running each test case
*/
public function setUp()
public function setUp(): void
{
}
/**
* Clean up after running each test case
*/
public function tearDown()
public function tearDown(): void
{
}
/**
* Clean up after running all test cases
*/
public static function tearDownAfterClass()
public static function tearDownAfterClass(): void
{
}

View File

@@ -2,7 +2,7 @@
/**
* TagTest
*
* PHP version 7.1.3
* PHP version 8.1.1
*
* @category Class
* @package OpenAPI\Server\Tests\Model
@@ -47,28 +47,28 @@ class TagTest extends TestCase
/**
* Setup before running any test case
*/
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
}
/**
* Setup before running each test case
*/
public function setUp()
public function setUp(): void
{
}
/**
* Clean up after running each test case
*/
public function tearDown()
public function tearDown(): void
{
}
/**
* Clean up after running all test cases
*/
public static function tearDownAfterClass()
public static function tearDownAfterClass(): void
{
}

View File

@@ -2,7 +2,7 @@
/**
* UserTest
*
* PHP version 7.1.3
* PHP version 8.1.1
*
* @category Class
* @package OpenAPI\Server\Tests\Model
@@ -47,28 +47,28 @@ class UserTest extends TestCase
/**
* Setup before running any test case
*/
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
}
/**
* Setup before running each test case
*/
public function setUp()
public function setUp(): void
{
}
/**
* Clean up after running each test case
*/
public function tearDown()
public function tearDown(): void
{
}
/**
* Clean up after running all test cases
*/
public static function tearDownAfterClass()
public static function tearDownAfterClass(): void
{
}

View File

@@ -5,4 +5,4 @@ framework:
secret: "testsecret"
test: ~
router:
resource: "%kernel.root_dir%/../Resources/config/routing.yml"
resource: "%kernel.project_dir%/../Resources/config/routing.yml"