mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-22 18:56:14 +01:00

[TASK] Make the controller tests more fine-grained (#856)

Tests should only test one thing (if possible).
This commit is contained in:
Oliver Klee 2023-06-20 09:19:57 +02:00 committed by GitHub
parent 77057e06a8
commit 2ab50201fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -77,10 +77,17 @@ final class TeaControllerTest extends UnitTestCase
$this->teaRepositoryMock->method('findAll')->willReturn($teas); $this->teaRepositoryMock->method('findAll')->willReturn($teas);
$this->viewMock->expects(self::once())->method('assign')->with('teas', $teas); $this->viewMock->expects(self::once())->method('assign')->with('teas', $teas);
self::assertInstanceOf( $this->subject->indexAction();
HtmlResponse::class, }
$this->subject->indexAction()
); /**
* @test
*/
public function indexActionReturnsHtmlResponse(): void
{
$result = $this->subject->indexAction();
self::assertInstanceOf(HtmlResponse::class, $result);
} }
/** /**
@ -91,9 +98,16 @@ final class TeaControllerTest extends UnitTestCase
$tea = new Tea(); $tea = new Tea();
$this->viewMock->expects(self::once())->method('assign')->with('tea', $tea); $this->viewMock->expects(self::once())->method('assign')->with('tea', $tea);
self::assertInstanceOf( $this->subject->showAction($tea);
HtmlResponse::class, }
$this->subject->showAction($tea)
); /**
* @test
*/
public function showActionAssignsReturnsHtmlResponse(): void
{
$result = $this->subject->showAction(new Tea());
self::assertInstanceOf(HtmlResponse::class, $result);
} }
} }