Skip to content

Commit

Permalink
Add tests for int backed enum and enum without backing
Browse files Browse the repository at this point in the history
  • Loading branch information
DidierLmn authored and Didier Laumen committed Oct 12, 2023
1 parent b7d2f90 commit 8d08f0f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Tests/Functional/Entity/ArticleType81IntBacked.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Nelmio\ApiDocBundle\Tests\Functional\Entity;

enum ArticleType81IntBacked: int
{
case DRAFT = 0;
case FINAL = 1;
}
9 changes: 9 additions & 0 deletions Tests/Functional/Entity/ArticleType81NotBacked.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Nelmio\ApiDocBundle\Tests\Functional\Entity;

enum ArticleType81IntBacked
{
case DRAFT;
case FINAL;
}
11 changes: 11 additions & 0 deletions Tests/Functional/FunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,17 @@ public function testEnumSupport()

$this->assertSame('string', $model->type);
$this->assertCount(2, $model->enum);

$model = $this->getModel('ArticleType81NotBacked');

$this->assertSame('string', $model->type);
$this->assertCount(2, $model->enum);


$model = $this->getModel('ArticleType81IntBacked');

$this->assertSame('integer', $model->type);
$this->assertCount(2, $model->enum);
}

public function testEntitiesWithOverriddenSchemaTypeDoNotReadOtherProperties()
Expand Down

0 comments on commit 8d08f0f

Please sign in to comment.