diff --git a/modules/openapi-generator/src/main/resources/php-symfony/testing/AppKernel.mustache b/modules/openapi-generator/src/main/resources/php-symfony/testing/AppKernel.mustache index 1b6c3273c3d6..dfd5e83f1f1d 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/testing/AppKernel.mustache +++ b/modules/openapi-generator/src/main/resources/php-symfony/testing/AppKernel.mustache @@ -8,18 +8,18 @@ use Symfony\Component\Config\Loader\LoaderInterface; class AppKernel extends Kernel { + /** + * @inheritDoc + */ public function registerBundles(): iterable { - $bundles = array( - new FrameworkBundle() - ); - - return $bundles; + return [ + new FrameworkBundle(), + ]; } /** - * @param LoaderInterface $loader - * @return mixed + * @inheritDoc * @throws \Exception */ public function registerContainerConfiguration(LoaderInterface $loader) diff --git a/modules/openapi-generator/src/main/resources/php-symfony/testing/ControllerTest.mustache b/modules/openapi-generator/src/main/resources/php-symfony/testing/ControllerTest.mustache index 087c6f05a97c..e4d5039db846 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/testing/ControllerTest.mustache +++ b/modules/openapi-generator/src/main/resources/php-symfony/testing/ControllerTest.mustache @@ -33,21 +33,16 @@ use Symfony\Component\HttpFoundation\Request; */ class ControllerTest extends TestCase { - /** * Tests isContentTypeAllowed static method. * - * @param string $contentType - * @param array $consumes - * @param bool $expectedReturn - * * @covers ::isContentTypeAllowed - * @dataProvider provideArgumentsForIsContentTypeAllowed + * @dataProvider dataProviderIsContentTypeAllowed */ - public function testIsContentTypeAllowed(string $contentType, array $consumes, bool $expectedReturn): void + public function testIsContentTypeAllowed(?string $contentType, array $consumes, bool $expectedReturn): void { $request = new Request(); - $request->headers->set('CONTENT_TYPE', $contentType, true);// last one argument overrides header + $request->headers->set('CONTENT_TYPE', $contentType);// last one argument overrides header $this->assertSame( $expectedReturn, Controller::isContentTypeAllowed($request, $consumes), @@ -60,7 +55,7 @@ class ControllerTest extends TestCase ); } - public function provideArgumentsForIsContentTypeAllowed(): array + public function dataProviderIsContentTypeAllowed(): array { return [ 'usual JSON content type' => [ diff --git a/modules/openapi-generator/src/main/resources/php-symfony/testing/api_test.mustache b/modules/openapi-generator/src/main/resources/php-symfony/testing/api_test.mustache index e48e6fd2634e..755fb72dba6a 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/testing/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/php-symfony/testing/api_test.mustache @@ -28,6 +28,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; * @package {{apiTestsPackage}} * @author openapi-generator contributors * @link https://github.com/openapitools/openapi-generator + * @coversDefaultClass \{{apiPackage}}\{{classname}} */ {{#operations}}class {{classname}}Test extends WebTestCase { @@ -102,6 +103,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; {{/pathParams}} $crawler = $client->request('{{httpMethod}}', $path{{#hasBodyParam}}, [], [], ['CONTENT_TYPE' => 'application/json']{{/hasBodyParam}}); + $this->markTestSkipped('Test for {{operationId}} not implemented'); } {{/operation}} diff --git a/modules/openapi-generator/src/main/resources/php-symfony/testing/model_test.mustache b/modules/openapi-generator/src/main/resources/php-symfony/testing/model_test.mustache index cc22eaf89d02..1d971d7530aa 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/testing/model_test.mustache +++ b/modules/openapi-generator/src/main/resources/php-symfony/testing/model_test.mustache @@ -21,20 +21,22 @@ namespace {{modelPackage}}; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** * {{classname}}Test Class Doc Comment * - * @category Class */ -// * @description {{description}}{{^description}}{{classname}}{{/description}} -/** + * @category Class + * @description {{description}}{{^description}}{{classname}}{{/description}} * @package {{modelTestsPackage}} * @author openapi-generator contributors * @link https://github.com/openapitools/openapi-generator + * @coversDefaultClass \{{modelPackage}}\{{classname}} */ class {{classname}}Test extends TestCase { + protected {{classname}}|MockObject $object; /** * Setup before running any test case @@ -48,6 +50,7 @@ class {{classname}}Test extends TestCase */ public function setUp(): void { + $this->object = $this->getMockBuilder({{classname}}::class)->getMockForAbstractClass(); } /** @@ -65,19 +68,25 @@ class {{classname}}Test extends TestCase } /** - * Test "{{classname}}" + * @group integration + * @small */ - public function test{{classname}}(): void + public function testTestClassExists(): void { - $test{{classname}} = new {{classname}}(); + $this->assertTrue(class_exists({{classname}}::class)); + $this->assertInstanceOf({{classname}}::class, $this->object); } {{#vars}} /** * Test attribute "{{name}}" + * + * @group unit + * @small */ public function testProperty{{nameInCamelCase}}(): void { + $this->markTestSkipped('Test for property {{name}} not implemented'); } {{/vars}} } diff --git a/modules/openapi-generator/src/main/resources/php-symfony/testing/phpunit.xml.mustache b/modules/openapi-generator/src/main/resources/php-symfony/testing/phpunit.xml.mustache index 3c46ece5012f..3e3eebd1bff6 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/testing/phpunit.xml.mustache +++ b/modules/openapi-generator/src/main/resources/php-symfony/testing/phpunit.xml.mustache @@ -1,24 +1,26 @@ - + stopOnFailure="false" + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> + + + {{apiSrcPath}} + {{modelSrcPath}} + {{controllerSrcPath}} + + - + {{apiTestPath}} {{modelTestPath}} {{controllerTestPath}} - - - {{apiSrcPath}} - {{modelSrcPath}} - {{controllerSrcPath}} - - diff --git a/modules/openapi-generator/src/main/resources/php-symfony/testing/test_config.yml b/modules/openapi-generator/src/main/resources/php-symfony/testing/test_config.yml index a06bcfef45aa..4c7970ab71ad 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/testing/test_config.yml +++ b/modules/openapi-generator/src/main/resources/php-symfony/testing/test_config.yml @@ -5,4 +5,4 @@ framework: secret: "testsecret" test: ~ router: - resource: "%kernel.project_dir%/../Resources/config/routing.yml" + resource: "%kernel.project_dir%/Resources/config/routing.yml" diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/PetApiInterfaceTest.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/PetApiInterfaceTest.php index f8fe90512b12..98d735524b91 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/PetApiInterfaceTest.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/PetApiInterfaceTest.php @@ -28,10 +28,6 @@ namespace OpenAPI\Server\Tests\Api; -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; @@ -42,6 +38,7 @@ * @package OpenAPI\Server\Tests\Api * @author openapi-generator contributors * @link https://github.com/openapitools/openapi-generator + * @coversDefaultClass \OpenAPI\Server\Api\PetApiInterface */ class PetApiInterfaceTest extends WebTestCase { @@ -85,13 +82,14 @@ public static function tearDownAfterClass(): void * Add a new pet to the store. * */ - public function testAddPet() + public function testAddPet(): void { $client = self::$client; $path = '/pet'; $crawler = $client->request('POST', $path, [], [], ['CONTENT_TYPE' => 'application/json']); + $this->markTestSkipped('Test for addPet not implemented'); } /** @@ -100,7 +98,7 @@ public function testAddPet() * Deletes a pet. * */ - public function testDeletePet() + public function testDeletePet(): void { $client = self::$client; @@ -110,6 +108,7 @@ public function testDeletePet() $path = str_replace($pattern, $data, $path); $crawler = $client->request('DELETE', $path); + $this->markTestSkipped('Test for deletePet not implemented'); } /** @@ -118,13 +117,14 @@ public function testDeletePet() * Finds Pets by status. * */ - public function testFindPetsByStatus() + public function testFindPetsByStatus(): void { $client = self::$client; $path = '/pet/findByStatus'; $crawler = $client->request('GET', $path); + $this->markTestSkipped('Test for findPetsByStatus not implemented'); } /** @@ -133,13 +133,14 @@ public function testFindPetsByStatus() * Finds Pets by tags. * */ - public function testFindPetsByTags() + public function testFindPetsByTags(): void { $client = self::$client; $path = '/pet/findByTags'; $crawler = $client->request('GET', $path); + $this->markTestSkipped('Test for findPetsByTags not implemented'); } /** @@ -148,7 +149,7 @@ public function testFindPetsByTags() * Find pet by ID. * */ - public function testGetPetById() + public function testGetPetById(): void { $client = self::$client; @@ -158,6 +159,7 @@ public function testGetPetById() $path = str_replace($pattern, $data, $path); $crawler = $client->request('GET', $path); + $this->markTestSkipped('Test for getPetById not implemented'); } /** @@ -166,13 +168,14 @@ public function testGetPetById() * Update an existing pet. * */ - public function testUpdatePet() + public function testUpdatePet(): void { $client = self::$client; $path = '/pet'; $crawler = $client->request('PUT', $path, [], [], ['CONTENT_TYPE' => 'application/json']); + $this->markTestSkipped('Test for updatePet not implemented'); } /** @@ -181,7 +184,7 @@ public function testUpdatePet() * Updates a pet in the store with form data. * */ - public function testUpdatePetWithForm() + public function testUpdatePetWithForm(): void { $client = self::$client; @@ -191,6 +194,7 @@ public function testUpdatePetWithForm() $path = str_replace($pattern, $data, $path); $crawler = $client->request('POST', $path); + $this->markTestSkipped('Test for updatePetWithForm not implemented'); } /** @@ -199,7 +203,7 @@ public function testUpdatePetWithForm() * uploads an image. * */ - public function testUploadFile() + public function testUploadFile(): void { $client = self::$client; @@ -209,13 +213,18 @@ public function testUploadFile() $path = str_replace($pattern, $data, $path); $crawler = $client->request('POST', $path); + $this->markTestSkipped('Test for uploadFile not implemented'); } - protected function genTestData($regexp) + /** + * @param string $regexp + * @return mixed + */ + protected function genTestData(string $regexp) { - $grammar = new \Hoa\File\Read('hoa://Library/Regex/Grammar.pp'); + $grammar = new \Hoa\File\Read('hoa://Library/Regex/Grammar.pp'); $compiler = \Hoa\Compiler\Llk\Llk::load($grammar); - $ast = $compiler->parse($regexp); + $ast = $compiler->parse($regexp); $generator = new \Hoa\Regex\Visitor\Isotropic(new \Hoa\Math\Sampler\Random()); return $generator->visit($ast); diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/StoreApiInterfaceTest.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/StoreApiInterfaceTest.php index 2acfddb51ee4..928160a944cf 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/StoreApiInterfaceTest.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/StoreApiInterfaceTest.php @@ -28,10 +28,6 @@ namespace OpenAPI\Server\Tests\Api; -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; @@ -42,6 +38,7 @@ * @package OpenAPI\Server\Tests\Api * @author openapi-generator contributors * @link https://github.com/openapitools/openapi-generator + * @coversDefaultClass \OpenAPI\Server\Api\StoreApiInterface */ class StoreApiInterfaceTest extends WebTestCase { @@ -85,7 +82,7 @@ public static function tearDownAfterClass(): void * Delete purchase order by ID. * */ - public function testDeleteOrder() + public function testDeleteOrder(): void { $client = self::$client; @@ -95,6 +92,7 @@ public function testDeleteOrder() $path = str_replace($pattern, $data, $path); $crawler = $client->request('DELETE', $path); + $this->markTestSkipped('Test for deleteOrder not implemented'); } /** @@ -103,13 +101,14 @@ public function testDeleteOrder() * Returns pet inventories by status. * */ - public function testGetInventory() + public function testGetInventory(): void { $client = self::$client; $path = '/store/inventory'; $crawler = $client->request('GET', $path); + $this->markTestSkipped('Test for getInventory not implemented'); } /** @@ -118,7 +117,7 @@ public function testGetInventory() * Find purchase order by ID. * */ - public function testGetOrderById() + public function testGetOrderById(): void { $client = self::$client; @@ -128,6 +127,7 @@ public function testGetOrderById() $path = str_replace($pattern, $data, $path); $crawler = $client->request('GET', $path); + $this->markTestSkipped('Test for getOrderById not implemented'); } /** @@ -136,20 +136,25 @@ public function testGetOrderById() * Place an order for a pet. * */ - public function testPlaceOrder() + public function testPlaceOrder(): void { $client = self::$client; $path = '/store/order'; $crawler = $client->request('POST', $path, [], [], ['CONTENT_TYPE' => 'application/json']); + $this->markTestSkipped('Test for placeOrder not implemented'); } - protected function genTestData($regexp) + /** + * @param string $regexp + * @return mixed + */ + protected function genTestData(string $regexp) { - $grammar = new \Hoa\File\Read('hoa://Library/Regex/Grammar.pp'); + $grammar = new \Hoa\File\Read('hoa://Library/Regex/Grammar.pp'); $compiler = \Hoa\Compiler\Llk\Llk::load($grammar); - $ast = $compiler->parse($regexp); + $ast = $compiler->parse($regexp); $generator = new \Hoa\Regex\Visitor\Isotropic(new \Hoa\Math\Sampler\Random()); return $generator->visit($ast); diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/UserApiInterfaceTest.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/UserApiInterfaceTest.php index 447113b321b8..ce64a85b1004 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/UserApiInterfaceTest.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Api/UserApiInterfaceTest.php @@ -28,10 +28,6 @@ namespace OpenAPI\Server\Tests\Api; -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; @@ -42,6 +38,7 @@ * @package OpenAPI\Server\Tests\Api * @author openapi-generator contributors * @link https://github.com/openapitools/openapi-generator + * @coversDefaultClass \OpenAPI\Server\Api\UserApiInterface */ class UserApiInterfaceTest extends WebTestCase { @@ -85,13 +82,14 @@ public static function tearDownAfterClass(): void * Create user. * */ - public function testCreateUser() + public function testCreateUser(): void { $client = self::$client; $path = '/user'; $crawler = $client->request('POST', $path, [], [], ['CONTENT_TYPE' => 'application/json']); + $this->markTestSkipped('Test for createUser not implemented'); } /** @@ -100,13 +98,14 @@ public function testCreateUser() * Creates list of users with given input array. * */ - public function testCreateUsersWithArrayInput() + public function testCreateUsersWithArrayInput(): void { $client = self::$client; $path = '/user/createWithArray'; $crawler = $client->request('POST', $path, [], [], ['CONTENT_TYPE' => 'application/json']); + $this->markTestSkipped('Test for createUsersWithArrayInput not implemented'); } /** @@ -115,13 +114,14 @@ public function testCreateUsersWithArrayInput() * Creates list of users with given input array. * */ - public function testCreateUsersWithListInput() + public function testCreateUsersWithListInput(): void { $client = self::$client; $path = '/user/createWithList'; $crawler = $client->request('POST', $path, [], [], ['CONTENT_TYPE' => 'application/json']); + $this->markTestSkipped('Test for createUsersWithListInput not implemented'); } /** @@ -130,7 +130,7 @@ public function testCreateUsersWithListInput() * Delete user. * */ - public function testDeleteUser() + public function testDeleteUser(): void { $client = self::$client; @@ -140,6 +140,7 @@ public function testDeleteUser() $path = str_replace($pattern, $data, $path); $crawler = $client->request('DELETE', $path); + $this->markTestSkipped('Test for deleteUser not implemented'); } /** @@ -148,7 +149,7 @@ public function testDeleteUser() * Get user by user name. * */ - public function testGetUserByName() + public function testGetUserByName(): void { $client = self::$client; @@ -158,6 +159,7 @@ public function testGetUserByName() $path = str_replace($pattern, $data, $path); $crawler = $client->request('GET', $path); + $this->markTestSkipped('Test for getUserByName not implemented'); } /** @@ -166,13 +168,14 @@ public function testGetUserByName() * Logs user into the system. * */ - public function testLoginUser() + public function testLoginUser(): void { $client = self::$client; $path = '/user/login'; $crawler = $client->request('GET', $path); + $this->markTestSkipped('Test for loginUser not implemented'); } /** @@ -181,13 +184,14 @@ public function testLoginUser() * Logs out current logged in user session. * */ - public function testLogoutUser() + public function testLogoutUser(): void { $client = self::$client; $path = '/user/logout'; $crawler = $client->request('GET', $path); + $this->markTestSkipped('Test for logoutUser not implemented'); } /** @@ -196,7 +200,7 @@ public function testLogoutUser() * Updated user. * */ - public function testUpdateUser() + public function testUpdateUser(): void { $client = self::$client; @@ -206,13 +210,18 @@ public function testUpdateUser() $path = str_replace($pattern, $data, $path); $crawler = $client->request('PUT', $path, [], [], ['CONTENT_TYPE' => 'application/json']); + $this->markTestSkipped('Test for updateUser not implemented'); } - protected function genTestData($regexp) + /** + * @param string $regexp + * @return mixed + */ + protected function genTestData(string $regexp) { - $grammar = new \Hoa\File\Read('hoa://Library/Regex/Grammar.pp'); + $grammar = new \Hoa\File\Read('hoa://Library/Regex/Grammar.pp'); $compiler = \Hoa\Compiler\Llk\Llk::load($grammar); - $ast = $compiler->parse($regexp); + $ast = $compiler->parse($regexp); $generator = new \Hoa\Regex\Visitor\Isotropic(new \Hoa\Math\Sampler\Random()); return $generator->visit($ast); diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/AppKernel.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/AppKernel.php index 88c6cd9fb90d..608b63fdc091 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/AppKernel.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/AppKernel.php @@ -8,18 +8,18 @@ class AppKernel extends Kernel { + /** + * @inheritDoc + */ public function registerBundles(): iterable { - $bundles = array( - new FrameworkBundle() - ); - - return $bundles; + return [ + new FrameworkBundle(), + ]; } /** - * @param LoaderInterface $loader - * @return mixed + * @inheritDoc * @throws \Exception */ public function registerContainerConfiguration(LoaderInterface $loader) diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Controller/ControllerTest.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Controller/ControllerTest.php index a53ca2e312fe..9e2328a813f0 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Controller/ControllerTest.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Controller/ControllerTest.php @@ -43,21 +43,16 @@ */ class ControllerTest extends TestCase { - /** * Tests isContentTypeAllowed static method. * - * @param string $contentType - * @param array $consumes - * @param bool $expectedReturn - * * @covers ::isContentTypeAllowed - * @dataProvider provideArgumentsForIsContentTypeAllowed + * @dataProvider dataProviderIsContentTypeAllowed */ - public function testIsContentTypeAllowed(string $contentType, array $consumes, bool $expectedReturn): void + public function testIsContentTypeAllowed(?string $contentType, array $consumes, bool $expectedReturn): void { $request = new Request(); - $request->headers->set('CONTENT_TYPE', $contentType, true);// last one argument overrides header + $request->headers->set('CONTENT_TYPE', $contentType);// last one argument overrides header $this->assertSame( $expectedReturn, Controller::isContentTypeAllowed($request, $consumes), @@ -70,7 +65,7 @@ public function testIsContentTypeAllowed(string $contentType, array $consumes, b ); } - public function provideArgumentsForIsContentTypeAllowed(): array + public function dataProviderIsContentTypeAllowed(): array { return [ 'usual JSON content type' => [ diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/ApiResponseTest.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/ApiResponseTest.php index 8bbaee822e3d..e1a93fc58dd9 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/ApiResponseTest.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/ApiResponseTest.php @@ -29,20 +29,22 @@ namespace OpenAPI\Server\Model; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** * ApiResponseTest Class Doc Comment * - * @category Class */ -// * @description Describes the result of uploading an image resource -/** + * @category Class + * @description Describes the result of uploading an image resource * @package OpenAPI\Server\Tests\Model * @author openapi-generator contributors * @link https://github.com/openapitools/openapi-generator + * @coversDefaultClass \OpenAPI\Server\Model\ApiResponse */ class ApiResponseTest extends TestCase { + protected ApiResponse|MockObject $object; /** * Setup before running any test case @@ -56,6 +58,7 @@ public static function setUpBeforeClass(): void */ public function setUp(): void { + $this->object = $this->getMockBuilder(ApiResponse::class)->getMockForAbstractClass(); } /** @@ -73,31 +76,45 @@ public static function tearDownAfterClass(): void } /** - * Test "ApiResponse" + * @group integration + * @small */ - public function testApiResponse() + public function testTestClassExists(): void { - $testApiResponse = new ApiResponse(); + $this->assertTrue(class_exists(ApiResponse::class)); + $this->assertInstanceOf(ApiResponse::class, $this->object); } /** * Test attribute "code" + * + * @group unit + * @small */ - public function testPropertyCode() + public function testPropertyCode(): void { + $this->markTestSkipped('Test for property code not implemented'); } /** * Test attribute "type" + * + * @group unit + * @small */ - public function testPropertyType() + public function testPropertyType(): void { + $this->markTestSkipped('Test for property type not implemented'); } /** * Test attribute "message" + * + * @group unit + * @small */ - public function testPropertyMessage() + public function testPropertyMessage(): void { + $this->markTestSkipped('Test for property message not implemented'); } } diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/CategoryTest.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/CategoryTest.php index 8b225b838ca2..83357931e9b0 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/CategoryTest.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/CategoryTest.php @@ -29,20 +29,22 @@ namespace OpenAPI\Server\Model; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** * CategoryTest Class Doc Comment * - * @category Class */ -// * @description A category for a pet -/** + * @category Class + * @description A category for a pet * @package OpenAPI\Server\Tests\Model * @author openapi-generator contributors * @link https://github.com/openapitools/openapi-generator + * @coversDefaultClass \OpenAPI\Server\Model\Category */ class CategoryTest extends TestCase { + protected Category|MockObject $object; /** * Setup before running any test case @@ -56,6 +58,7 @@ public static function setUpBeforeClass(): void */ public function setUp(): void { + $this->object = $this->getMockBuilder(Category::class)->getMockForAbstractClass(); } /** @@ -73,24 +76,34 @@ public static function tearDownAfterClass(): void } /** - * Test "Category" + * @group integration + * @small */ - public function testCategory() + public function testTestClassExists(): void { - $testCategory = new Category(); + $this->assertTrue(class_exists(Category::class)); + $this->assertInstanceOf(Category::class, $this->object); } /** * Test attribute "id" + * + * @group unit + * @small */ - public function testPropertyId() + public function testPropertyId(): void { + $this->markTestSkipped('Test for property id not implemented'); } /** * Test attribute "name" + * + * @group unit + * @small */ - public function testPropertyName() + public function testPropertyName(): void { + $this->markTestSkipped('Test for property name not implemented'); } } diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/OrderTest.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/OrderTest.php index 8a65c0a5115d..230058daff07 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/OrderTest.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/OrderTest.php @@ -29,20 +29,22 @@ namespace OpenAPI\Server\Model; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** * OrderTest Class Doc Comment * - * @category Class */ -// * @description An order for a pets from the pet store -/** + * @category Class + * @description An order for a pets from the pet store * @package OpenAPI\Server\Tests\Model * @author openapi-generator contributors * @link https://github.com/openapitools/openapi-generator + * @coversDefaultClass \OpenAPI\Server\Model\Order */ class OrderTest extends TestCase { + protected Order|MockObject $object; /** * Setup before running any test case @@ -56,6 +58,7 @@ public static function setUpBeforeClass(): void */ public function setUp(): void { + $this->object = $this->getMockBuilder(Order::class)->getMockForAbstractClass(); } /** @@ -73,52 +76,78 @@ public static function tearDownAfterClass(): void } /** - * Test "Order" + * @group integration + * @small */ - public function testOrder() + public function testTestClassExists(): void { - $testOrder = new Order(); + $this->assertTrue(class_exists(Order::class)); + $this->assertInstanceOf(Order::class, $this->object); } /** * Test attribute "id" + * + * @group unit + * @small */ - public function testPropertyId() + public function testPropertyId(): void { + $this->markTestSkipped('Test for property id not implemented'); } /** * Test attribute "petId" + * + * @group unit + * @small */ - public function testPropertyPetId() + public function testPropertyPetId(): void { + $this->markTestSkipped('Test for property petId not implemented'); } /** * Test attribute "quantity" + * + * @group unit + * @small */ - public function testPropertyQuantity() + public function testPropertyQuantity(): void { + $this->markTestSkipped('Test for property quantity not implemented'); } /** * Test attribute "shipDate" + * + * @group unit + * @small */ - public function testPropertyShipDate() + public function testPropertyShipDate(): void { + $this->markTestSkipped('Test for property shipDate not implemented'); } /** * Test attribute "status" + * + * @group unit + * @small */ - public function testPropertyStatus() + public function testPropertyStatus(): void { + $this->markTestSkipped('Test for property status not implemented'); } /** * Test attribute "complete" + * + * @group unit + * @small */ - public function testPropertyComplete() + public function testPropertyComplete(): void { + $this->markTestSkipped('Test for property complete not implemented'); } } diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/PetTest.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/PetTest.php index 0c47d89d1af7..defee76700df 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/PetTest.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/PetTest.php @@ -29,20 +29,22 @@ namespace OpenAPI\Server\Model; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** * PetTest Class Doc Comment * - * @category Class */ -// * @description A pet for sale in the pet store -/** + * @category Class + * @description A pet for sale in the pet store * @package OpenAPI\Server\Tests\Model * @author openapi-generator contributors * @link https://github.com/openapitools/openapi-generator + * @coversDefaultClass \OpenAPI\Server\Model\Pet */ class PetTest extends TestCase { + protected Pet|MockObject $object; /** * Setup before running any test case @@ -56,6 +58,7 @@ public static function setUpBeforeClass(): void */ public function setUp(): void { + $this->object = $this->getMockBuilder(Pet::class)->getMockForAbstractClass(); } /** @@ -73,52 +76,78 @@ public static function tearDownAfterClass(): void } /** - * Test "Pet" + * @group integration + * @small */ - public function testPet() + public function testTestClassExists(): void { - $testPet = new Pet(); + $this->assertTrue(class_exists(Pet::class)); + $this->assertInstanceOf(Pet::class, $this->object); } /** * Test attribute "id" + * + * @group unit + * @small */ - public function testPropertyId() + public function testPropertyId(): void { + $this->markTestSkipped('Test for property id not implemented'); } /** * Test attribute "category" + * + * @group unit + * @small */ - public function testPropertyCategory() + public function testPropertyCategory(): void { + $this->markTestSkipped('Test for property category not implemented'); } /** * Test attribute "name" + * + * @group unit + * @small */ - public function testPropertyName() + public function testPropertyName(): void { + $this->markTestSkipped('Test for property name not implemented'); } /** * Test attribute "photoUrls" + * + * @group unit + * @small */ - public function testPropertyPhotoUrls() + public function testPropertyPhotoUrls(): void { + $this->markTestSkipped('Test for property photoUrls not implemented'); } /** * Test attribute "tags" + * + * @group unit + * @small */ - public function testPropertyTags() + public function testPropertyTags(): void { + $this->markTestSkipped('Test for property tags not implemented'); } /** * Test attribute "status" + * + * @group unit + * @small */ - public function testPropertyStatus() + public function testPropertyStatus(): void { + $this->markTestSkipped('Test for property status not implemented'); } } diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/TagTest.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/TagTest.php index 313756158238..1296d5972af5 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/TagTest.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/TagTest.php @@ -29,20 +29,22 @@ namespace OpenAPI\Server\Model; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** * TagTest Class Doc Comment * - * @category Class */ -// * @description A tag for a pet -/** + * @category Class + * @description A tag for a pet * @package OpenAPI\Server\Tests\Model * @author openapi-generator contributors * @link https://github.com/openapitools/openapi-generator + * @coversDefaultClass \OpenAPI\Server\Model\Tag */ class TagTest extends TestCase { + protected Tag|MockObject $object; /** * Setup before running any test case @@ -56,6 +58,7 @@ public static function setUpBeforeClass(): void */ public function setUp(): void { + $this->object = $this->getMockBuilder(Tag::class)->getMockForAbstractClass(); } /** @@ -73,24 +76,34 @@ public static function tearDownAfterClass(): void } /** - * Test "Tag" + * @group integration + * @small */ - public function testTag() + public function testTestClassExists(): void { - $testTag = new Tag(); + $this->assertTrue(class_exists(Tag::class)); + $this->assertInstanceOf(Tag::class, $this->object); } /** * Test attribute "id" + * + * @group unit + * @small */ - public function testPropertyId() + public function testPropertyId(): void { + $this->markTestSkipped('Test for property id not implemented'); } /** * Test attribute "name" + * + * @group unit + * @small */ - public function testPropertyName() + public function testPropertyName(): void { + $this->markTestSkipped('Test for property name not implemented'); } } diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/UserTest.php b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/UserTest.php index 0e324a638dc3..c485d931d964 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/UserTest.php +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/Model/UserTest.php @@ -29,20 +29,22 @@ namespace OpenAPI\Server\Model; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** * UserTest Class Doc Comment * - * @category Class */ -// * @description A User who is purchasing from the pet store -/** + * @category Class + * @description A User who is purchasing from the pet store * @package OpenAPI\Server\Tests\Model * @author openapi-generator contributors * @link https://github.com/openapitools/openapi-generator + * @coversDefaultClass \OpenAPI\Server\Model\User */ class UserTest extends TestCase { + protected User|MockObject $object; /** * Setup before running any test case @@ -56,6 +58,7 @@ public static function setUpBeforeClass(): void */ public function setUp(): void { + $this->object = $this->getMockBuilder(User::class)->getMockForAbstractClass(); } /** @@ -73,66 +76,100 @@ public static function tearDownAfterClass(): void } /** - * Test "User" + * @group integration + * @small */ - public function testUser() + public function testTestClassExists(): void { - $testUser = new User(); + $this->assertTrue(class_exists(User::class)); + $this->assertInstanceOf(User::class, $this->object); } /** * Test attribute "id" + * + * @group unit + * @small */ - public function testPropertyId() + public function testPropertyId(): void { + $this->markTestSkipped('Test for property id not implemented'); } /** * Test attribute "username" + * + * @group unit + * @small */ - public function testPropertyUsername() + public function testPropertyUsername(): void { + $this->markTestSkipped('Test for property username not implemented'); } /** * Test attribute "firstName" + * + * @group unit + * @small */ - public function testPropertyFirstName() + public function testPropertyFirstName(): void { + $this->markTestSkipped('Test for property firstName not implemented'); } /** * Test attribute "lastName" + * + * @group unit + * @small */ - public function testPropertyLastName() + public function testPropertyLastName(): void { + $this->markTestSkipped('Test for property lastName not implemented'); } /** * Test attribute "email" + * + * @group unit + * @small */ - public function testPropertyEmail() + public function testPropertyEmail(): void { + $this->markTestSkipped('Test for property email not implemented'); } /** * Test attribute "password" + * + * @group unit + * @small */ - public function testPropertyPassword() + public function testPropertyPassword(): void { + $this->markTestSkipped('Test for property password not implemented'); } /** * Test attribute "phone" + * + * @group unit + * @small */ - public function testPropertyPhone() + public function testPropertyPhone(): void { + $this->markTestSkipped('Test for property phone not implemented'); } /** * Test attribute "userStatus" + * + * @group unit + * @small */ - public function testPropertyUserStatus() + public function testPropertyUserStatus(): void { + $this->markTestSkipped('Test for property userStatus not implemented'); } } diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/test_config.yml b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/test_config.yml index a06bcfef45aa..4c7970ab71ad 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/test_config.yml +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Tests/test_config.yml @@ -5,4 +5,4 @@ framework: secret: "testsecret" test: ~ router: - resource: "%kernel.project_dir%/../Resources/config/routing.yml" + resource: "%kernel.project_dir%/Resources/config/routing.yml" diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/phpunit.xml.dist b/samples/server/petstore/php-symfony/SymfonyBundle-php/phpunit.xml.dist index e754829e6283..a12d3c3c8708 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/phpunit.xml.dist +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/phpunit.xml.dist @@ -1,24 +1,26 @@ - + stopOnFailure="false" + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"> + + + ././Api + ././Model + ././Controller + + - + ./Tests/Api ./Tests/Model ./Tests/Controller - - - ././Api - ././Model - ././Controller - -