Skip to content
Draft
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
56 changes: 56 additions & 0 deletions tests/ViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,62 @@ public function testWithRenderersInvalidRendererTypeThrowsException(): void
]);
}

public function testWithRenderersNullRendererThrowsException(): void
{
$view = TestHelper::createView();

$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage(
'Renderer null is not an instance of ' . TemplateRendererInterface::class . '.'
);

$view->withRenderers([
'php' => null,
]);
}

public function testWithRenderersStringRendererThrowsException(): void
{
$view = TestHelper::createView();

$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage(
'Renderer string is not an instance of ' . TemplateRendererInterface::class . '.'
);

$view->withRenderers([
'php' => 'invalid-renderer',
]);
}

public function testWithRenderersArrayRendererThrowsException(): void
{
$view = TestHelper::createView();

$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage(
'Renderer array is not an instance of ' . TemplateRendererInterface::class . '.'
);

$view->withRenderers([
'php' => [],
]);
}

public function testWithRenderersIntegerRendererThrowsException(): void
{
$view = TestHelper::createView();

$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage(
'Renderer int is not an instance of ' . TemplateRendererInterface::class . '.'
);

$view->withRenderers([
'php' => 123,
]);
}

public function testWithRenderersNumericKeyImplicitThrowsException(): void
{
$view = TestHelper::createView();
Expand Down
Loading