[PHP] Enhance Symfony generator (#12532)

* Enhance Symfony generator

  - Add missing typehints
  - Add missing use statements
  - Simplify model ctor
  - Change fallthrough Exception to Throwable
  - prevent storing result of void methods
  - fix validate method
  - add default null values to model properties
  - simplify API interface return values
  - fix/rework default value implementation
  - fix optional params deprecation warnings
  - ..

For more details check out the PR: https://github.com/OpenAPITools/openapi-generator/pull/12532

* Enhance Symfony generator Tests

  - Skip risky tests
  - Fix type hint error
  - Fix class exists tests
  - Fix broken doc block
  - Enhance annotations
  - Update phpunit.xml.dist
  - Fix test config resource location
This commit is contained in:
Daniel Metzner
2022-06-25 14:53:21 +02:00
committed by GitHub
parent 286a31c019
commit 3b15bb8a4e
56 changed files with 862 additions and 558 deletions

View File

@@ -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 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @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 @@ class PetApiInterfaceTest extends WebTestCase
* 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 @@ class PetApiInterfaceTest extends WebTestCase
* Deletes a pet.
*
*/
public function testDeletePet()
public function testDeletePet(): void
{
$client = self::$client;
@@ -110,6 +108,7 @@ class PetApiInterfaceTest extends WebTestCase
$path = str_replace($pattern, $data, $path);
$crawler = $client->request('DELETE', $path);
$this->markTestSkipped('Test for deletePet not implemented');
}
/**
@@ -118,13 +117,14 @@ class PetApiInterfaceTest extends WebTestCase
* 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 @@ class PetApiInterfaceTest extends WebTestCase
* 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 @@ class PetApiInterfaceTest extends WebTestCase
* Find pet by ID.
*
*/
public function testGetPetById()
public function testGetPetById(): void
{
$client = self::$client;
@@ -158,6 +159,7 @@ class PetApiInterfaceTest extends WebTestCase
$path = str_replace($pattern, $data, $path);
$crawler = $client->request('GET', $path);
$this->markTestSkipped('Test for getPetById not implemented');
}
/**
@@ -166,13 +168,14 @@ class PetApiInterfaceTest extends WebTestCase
* 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 @@ class PetApiInterfaceTest extends WebTestCase
* Updates a pet in the store with form data.
*
*/
public function testUpdatePetWithForm()
public function testUpdatePetWithForm(): void
{
$client = self::$client;
@@ -191,6 +194,7 @@ class PetApiInterfaceTest extends WebTestCase
$path = str_replace($pattern, $data, $path);
$crawler = $client->request('POST', $path);
$this->markTestSkipped('Test for updatePetWithForm not implemented');
}
/**
@@ -199,7 +203,7 @@ class PetApiInterfaceTest extends WebTestCase
* uploads an image.
*
*/
public function testUploadFile()
public function testUploadFile(): void
{
$client = self::$client;
@@ -209,13 +213,18 @@ class PetApiInterfaceTest extends WebTestCase
$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);

View File

@@ -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 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @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 @@ class StoreApiInterfaceTest extends WebTestCase
* Delete purchase order by ID.
*
*/
public function testDeleteOrder()
public function testDeleteOrder(): void
{
$client = self::$client;
@@ -95,6 +92,7 @@ class StoreApiInterfaceTest extends WebTestCase
$path = str_replace($pattern, $data, $path);
$crawler = $client->request('DELETE', $path);
$this->markTestSkipped('Test for deleteOrder not implemented');
}
/**
@@ -103,13 +101,14 @@ class StoreApiInterfaceTest extends WebTestCase
* 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 @@ class StoreApiInterfaceTest extends WebTestCase
* Find purchase order by ID.
*
*/
public function testGetOrderById()
public function testGetOrderById(): void
{
$client = self::$client;
@@ -128,6 +127,7 @@ class StoreApiInterfaceTest extends WebTestCase
$path = str_replace($pattern, $data, $path);
$crawler = $client->request('GET', $path);
$this->markTestSkipped('Test for getOrderById not implemented');
}
/**
@@ -136,20 +136,25 @@ class StoreApiInterfaceTest extends WebTestCase
* 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);

View File

@@ -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 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* @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 @@ class UserApiInterfaceTest extends WebTestCase
* 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 @@ class UserApiInterfaceTest extends WebTestCase
* 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 @@ class UserApiInterfaceTest extends WebTestCase
* 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 @@ class UserApiInterfaceTest extends WebTestCase
* Delete user.
*
*/
public function testDeleteUser()
public function testDeleteUser(): void
{
$client = self::$client;
@@ -140,6 +140,7 @@ class UserApiInterfaceTest extends WebTestCase
$path = str_replace($pattern, $data, $path);
$crawler = $client->request('DELETE', $path);
$this->markTestSkipped('Test for deleteUser not implemented');
}
/**
@@ -148,7 +149,7 @@ class UserApiInterfaceTest extends WebTestCase
* Get user by user name.
*
*/
public function testGetUserByName()
public function testGetUserByName(): void
{
$client = self::$client;
@@ -158,6 +159,7 @@ class UserApiInterfaceTest extends WebTestCase
$path = str_replace($pattern, $data, $path);
$crawler = $client->request('GET', $path);
$this->markTestSkipped('Test for getUserByName not implemented');
}
/**
@@ -166,13 +168,14 @@ class UserApiInterfaceTest extends WebTestCase
* 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 @@ class UserApiInterfaceTest extends WebTestCase
* 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 @@ class UserApiInterfaceTest extends WebTestCase
* Updated user.
*
*/
public function testUpdateUser()
public function testUpdateUser(): void
{
$client = self::$client;
@@ -206,13 +210,18 @@ class UserApiInterfaceTest extends WebTestCase
$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);

View File

@@ -8,15 +8,20 @@ use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
/**
* @inheritDoc
*/
public function registerBundles(): iterable
{
$bundles = array(
new FrameworkBundle()
);
return $bundles;
return [
new FrameworkBundle(),
];
}
/**
* @inheritDoc
* @throws \Exception
*/
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/test_config.yml');

View File

@@ -43,21 +43,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($contentType, array $consumes, $expectedReturn)
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 @@ class ControllerTest extends TestCase
);
}
public function provideArgumentsForIsContentTypeAllowed()
public function dataProviderIsContentTypeAllowed(): array
{
return [
'usual JSON content type' => [

View File

@@ -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 @@ class ApiResponseTest extends TestCase
*/
public function setUp(): void
{
$this->object = $this->getMockBuilder(ApiResponse::class)->getMockForAbstractClass();
}
/**
@@ -73,31 +76,45 @@ class ApiResponseTest extends TestCase
}
/**
* 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');
}
}

View File

@@ -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 @@ class CategoryTest extends TestCase
*/
public function setUp(): void
{
$this->object = $this->getMockBuilder(Category::class)->getMockForAbstractClass();
}
/**
@@ -73,24 +76,34 @@ class CategoryTest extends TestCase
}
/**
* 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');
}
}

View File

@@ -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 @@ class OrderTest extends TestCase
*/
public function setUp(): void
{
$this->object = $this->getMockBuilder(Order::class)->getMockForAbstractClass();
}
/**
@@ -73,52 +76,78 @@ class OrderTest extends TestCase
}
/**
* 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');
}
}

View File

@@ -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 @@ class PetTest extends TestCase
*/
public function setUp(): void
{
$this->object = $this->getMockBuilder(Pet::class)->getMockForAbstractClass();
}
/**
@@ -73,52 +76,78 @@ class PetTest extends TestCase
}
/**
* 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');
}
}

View File

@@ -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 @@ class TagTest extends TestCase
*/
public function setUp(): void
{
$this->object = $this->getMockBuilder(Tag::class)->getMockForAbstractClass();
}
/**
@@ -73,24 +76,34 @@ class TagTest extends TestCase
}
/**
* 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');
}
}

View File

@@ -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 @@ class UserTest extends TestCase
*/
public function setUp(): void
{
$this->object = $this->getMockBuilder(User::class)->getMockForAbstractClass();
}
/**
@@ -73,66 +76,100 @@ class UserTest extends TestCase
}
/**
* 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');
}
}

View File

@@ -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"