Skip to content

Commit

Permalink
feat: operation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferror committed May 4, 2024
1 parent aa2c967 commit 4cd77b3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
15 changes: 11 additions & 4 deletions src/Schema/V3/InfoRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,19 @@

final readonly class InfoRenderer
{
public function render(array $document): array
public function __construct(
public string $title,
public string $description,
public string $version,
) {
}

public function render(): array
{
return [
'title' => $document['title'],
'version' => $document['version'],
'description' => $document['description'],
'title' => $this->title,
'version' => $this->version,
'description' => $this->description,
];
}
}
1 change: 1 addition & 0 deletions tests/Unit/DocumentationEditorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function testDocument(): void
],
],
'channels' => [],
'operations' => [],
];

$this->assertEquals($expected, $actual);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function testUserSignedUp(): void
'type' => 'subscribe',
],
],
'operations' => [],
];

$this->assertEquals($expected, $actual);
Expand Down Expand Up @@ -154,6 +155,7 @@ public function testProductCreated(): void
'type' => 'subscribe',
],
],
'operations' => [],
];

$this->assertEquals($expected, $actual);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function test(): void
],
],
'channels' => [],
'operations' => [],
];

$this->assertEquals($expected, $documentation->document(UserSignedUp::class)->toArray());
Expand Down Expand Up @@ -98,9 +99,9 @@ public function testEnum(): void
],
],
'channels' => [],
'operations' => [],
];


$actual = $documentation->document(ProductCreated::class)->toArray();

$this->assertEquals($expected, $actual);
Expand Down

0 comments on commit 4cd77b3

Please sign in to comment.