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

[TASK] Make the repository tests more fine-grained (#855)

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

View file

@ -70,14 +70,27 @@ final class TeaRepositoryTest extends FunctionalTestCase
/** /**
* @test * @test
*/ */
public function findByUidForExistingRecordReturnsModelWithData(): void public function findByUidForExistingRecordReturnsModel(): void
{ {
$this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/Tea.csv'); $this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/Tea.csv');
$uid = 1; $uid = 1;
$model = $this->subject->findByUid($uid); $model = $this->subject->findByUid($uid);
self::assertNotNull($model); self::assertInstanceOf(Tea::class, $model);
}
/**
* @test
*/
public function findByUidForExistingRecordMapsAllScalarData(): void
{
$this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/Tea.csv');
$uid = 1;
$model = $this->subject->findByUid($uid);
self::assertInstanceOf(Tea::class, $model);
self::assertSame('Earl Grey', $model->getTitle()); self::assertSame('Earl Grey', $model->getTitle());
self::assertSame('Fresh and hot.', $model->getDescription()); self::assertSame('Fresh and hot.', $model->getDescription());
} }