mirror of
https://github.com/FriendsOfTYPO3/tea.git
synced 2024-11-10 04:16:13 +01:00
[TASK] Make the controller tests more fine-grained (#856)
Tests should only test one thing (if possible).
This commit is contained in:
parent
77057e06a8
commit
2ab50201fa
1 changed files with 22 additions and 8 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue