Skip to content

Commit

Permalink
Improved tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stollr committed Apr 28, 2024
1 parent 86d224c commit 3b2905a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
2 changes: 0 additions & 2 deletions tests/Functional/Controller/ApiController80.php
Expand Up @@ -418,8 +418,6 @@ public function entityWithObjectType()
/**
* @Route("/entity-with-uuid", methods={"GET", "POST"})
*
* @OA\Get(operationId="entity-with-uuid")
*
* @OA\Response(response=200, description="success", @OA\JsonContent(
* ref=@Model(type=EntityWithUuid::class),
* ))
Expand Down
1 change: 0 additions & 1 deletion tests/Functional/Controller/ApiController81.php
Expand Up @@ -347,7 +347,6 @@ public function entityWithObjectType()
}

#[Route('/entity-with-uuid', methods: ['GET', 'POST'])]
#[OA\Get(operationId: 'entity-with-uuid')]
#[OA\Response(
response: 200,
description: 'success',
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/Entity/EntityWithUuid.php
Expand Up @@ -6,8 +6,8 @@

class EntityWithUuid
{
public ?Uuid $id;
private string $name;
public Uuid $id;
public string $name;

public function __construct(string $name)
{
Expand Down
17 changes: 17 additions & 0 deletions tests/Functional/FunctionalTest.php
Expand Up @@ -900,11 +900,28 @@ public function testEntityWithUuid()
{
$model = $this->getModel('EntityWithUuid');

$json = json_decode($model->toJson(), true);

$this->assertSame('object', $model->type);

Check failure on line 905 in tests/Functional/FunctionalTest.php

View workflow job for this annotation

GitHub Actions / PHPStan

Dynamic call to static method PHPUnit\Framework\Assert::assertSame().

$this->assertSame('id', $model->properties[0]->property);

Check failure on line 907 in tests/Functional/FunctionalTest.php

View workflow job for this annotation

GitHub Actions / PHPStan

Dynamic call to static method PHPUnit\Framework\Assert::assertSame().
$this->assertSame('string', $model->properties[0]->type);

Check failure on line 908 in tests/Functional/FunctionalTest.php

View workflow job for this annotation

GitHub Actions / PHPStan

Dynamic call to static method PHPUnit\Framework\Assert::assertSame().
$this->assertSame('uuid', $model->properties[0]->format);

Check failure on line 909 in tests/Functional/FunctionalTest.php

View workflow job for this annotation

GitHub Actions / PHPStan

Dynamic call to static method PHPUnit\Framework\Assert::assertSame().

$this->assertEquals([

Check failure on line 911 in tests/Functional/FunctionalTest.php

View workflow job for this annotation

GitHub Actions / PHPStan

Dynamic call to static method PHPUnit\Framework\Assert::assertEquals().
'schema' => 'EntityWithUuid',
'type' => 'object',
'required' => ['id', 'name'],
'properties' => [
'id' => [
'type' => 'string',
'format' => 'uuid',
],
'name' => [
'type' => 'string',
]
],
], json_decode($model->toJson(), true));
}

public function testEntitiesWithRefInSchemaDoNoReadOtherProperties(): void
Expand Down

0 comments on commit 3b2905a

Please sign in to comment.