Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/Result/AbstractResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public function jsonSerialize(): array
{
return [
'status' => $this->getStatus(),
'sources' => $this->sources->sources(),
];
}
}
19 changes: 0 additions & 19 deletions tests/Result/AbstractResultTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,6 @@ public function test_it_can_add_sources_to_result(): void
static::assertSame('See the docs for more info', $sources[0]->content);
}

public function test_it_includes_sources_in_json_serialization(): void
{
$result = $this->createResult();
$result->sources()->add(
new Source('Docs', 'https://docs.example.com', 'See docs'),
new Source('Help', 'https://help.example.com', 'Need help')
);

$json = json_encode($result, JSON_THROW_ON_ERROR);
$data = json_decode($json, true, 512, JSON_THROW_ON_ERROR);

static::assertArrayHasKey('sources', $data);
static::assertCount(2, $data['sources']);
static::assertSame('Docs', $data['sources'][0]['name']);
static::assertSame('https://docs.example.com', $data['sources'][0]['reference']);
static::assertSame('See docs', $data['sources'][0]['content']);
static::assertSame('Help', $data['sources'][1]['name']);
}

public function test_it_can_add_multiple_sources_at_once(): void
{
$result = $this->createResult();
Expand Down