mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-10 01:36:13 +01:00

[CLEANUP] Use more stubs instead of mocks (#995)

This makes the purpose of the test doubles more clear to the reader.

Fixes #986
This commit is contained in:
Oliver Klee 2023-11-18 06:48:56 +01:00 committed by GitHub
parent 3cdf8df7a0
commit 450905287c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -114,7 +114,7 @@ final class FrontEndEditorControllerTest extends UnitTestCase
$userUid = 5; $userUid = 5;
$this->setUidOfLoggedInUser($userUid); $this->setUidOfLoggedInUser($userUid);
$teas = $this->createMock(QueryResultInterface::class); $teas = $this->createStub(QueryResultInterface::class);
$this->teaRepositoryMock->method('findByOwnerUid')->with($userUid)->willReturn($teas); $this->teaRepositoryMock->method('findByOwnerUid')->with($userUid)->willReturn($teas);
$this->viewMock->expects(self::once())->method('assign')->with('teas', $teas); $this->viewMock->expects(self::once())->method('assign')->with('teas', $teas);

View file

@ -68,7 +68,7 @@ final class TeaControllerTest extends UnitTestCase
*/ */
public function indexActionAssignsAllTeaAsTeasToView(): void public function indexActionAssignsAllTeaAsTeasToView(): void
{ {
$teas = $this->createMock(QueryResultInterface::class); $teas = $this->createStub(QueryResultInterface::class);
$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);