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

[TASK] Split up the DB fixtures for the functional tests (#993)

This makes the fixture more minimal and reduces cross-dependencies
between tests.

Also consistently avoid quotes for integer data in CSV DB fixtures.

Fixes #988
This commit is contained in:
Oliver Klee 2023-11-19 22:36:32 +01:00 committed by GitHub
parent d15bd079d6
commit d9718fd054
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 27 additions and 18 deletions

View file

@ -1,8 +0,0 @@
"tx_tea_domain_model_product_tea"
,"uid","pid","title","description","image","owner"
,"1","1","Earl Grey","Fresh and hot.",0,2
,"2","1","Assam","Dark and strong.",0,0
,"3","1","Gunpowder","Bitter and very green.",1,0
"sys_file_reference"
,"uid","pid","uid_foreign","tablenames","fieldname"
,"1","1","3","tx_tea_domain_model_product_tea","image"
Can't render this file because it contains an unexpected character in line 2 and column 2.

View file

@ -0,0 +1,3 @@
"tx_tea_domain_model_product_tea"
,"uid","pid","title"
,1,1,"Earl Grey"
Can't render this file because it has a wrong number of fields in line 2.

View file

@ -0,0 +1,3 @@
"tx_tea_domain_model_product_tea"
,"uid","pid","title","description","owner"
,1,1,"Earl Grey","Fresh and hot.",2
Can't render this file because it has a wrong number of fields in line 2.

View file

@ -0,0 +1,7 @@
"tx_tea_domain_model_product_tea"
,"uid","pid","title","image",
,1,1,"Gunpowder",1
"sys_file_reference"
,"uid","uid_foreign","tablenames","fieldname"
,1,1,"tx_tea_domain_model_product_tea","image"
Can't render this file because it contains an unexpected character in line 2 and column 2.

View file

@ -1,3 +1,3 @@
"tx_tea_domain_model_product_tea" "tx_tea_domain_model_product_tea"
,"uid","pid","title","owner" ,"uid","pid","title","owner"
,"1","1","Earl Grey",0 ,1,1,"Earl Grey",0

Can't render this file because it has a wrong number of fields in line 2.

View file

@ -1,4 +1,4 @@
"tx_tea_domain_model_product_tea" "tx_tea_domain_model_product_tea"
,"uid","pid","title","owner" ,"uid","pid","title","owner"
,"1","1","Earl Grey",1 ,1,1,"Earl Grey",1
,"2","1","Assam",1 ,2,1,"Assam",1

Can't render this file because it has a wrong number of fields in line 2.

View file

@ -0,0 +1,4 @@
"tx_tea_domain_model_product_tea"
,"uid","pid","title"
,1,1,"Earl Grey"
,2,1,"Assam"
Can't render this file because it has a wrong number of fields in line 2.

View file

@ -46,11 +46,11 @@ final class TeaRepositoryTest extends FunctionalTestCase
*/ */
public function findAllWithRecordsFindsRecordsFromAllPages(): void public function findAllWithRecordsFindsRecordsFromAllPages(): void
{ {
$this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/Tea.csv'); $this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TeaOnPage.csv');
$result = $this->subject->findAll(); $result = $this->subject->findAll();
self::assertGreaterThanOrEqual(1, \count($result)); self::assertCount(1, $result);
} }
/** /**
@ -58,7 +58,7 @@ final class TeaRepositoryTest extends FunctionalTestCase
*/ */
public function findAllSortsByTitleInAscendingOrder(): void public function findAllSortsByTitleInAscendingOrder(): void
{ {
$this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/Tea.csv'); $this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TwoUnsortedTeas.csv');
$result = $this->subject->findAll(); $result = $this->subject->findAll();
@ -71,7 +71,7 @@ final class TeaRepositoryTest extends FunctionalTestCase
*/ */
public function findByUidForExistingRecordReturnsModel(): void public function findByUidForExistingRecordReturnsModel(): void
{ {
$this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/Tea.csv'); $this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TeaWithAllScalarData.csv');
$model = $this->subject->findByUid(1); $model = $this->subject->findByUid(1);
@ -83,7 +83,7 @@ final class TeaRepositoryTest extends FunctionalTestCase
*/ */
public function findByUidForExistingRecordMapsAllScalarData(): void public function findByUidForExistingRecordMapsAllScalarData(): void
{ {
$this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/Tea.csv'); $this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TeaWithAllScalarData.csv');
$model = $this->subject->findByUid(1); $model = $this->subject->findByUid(1);
self::assertInstanceOf(Tea::class, $model); self::assertInstanceOf(Tea::class, $model);
@ -98,9 +98,9 @@ final class TeaRepositoryTest extends FunctionalTestCase
*/ */
public function fillsImageRelation(): void public function fillsImageRelation(): void
{ {
$this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/Tea.csv'); $this->importCSVDataSet(__DIR__ . '/../Fixtures/Product/TeaWithImage.csv');
$model = $this->subject->findByUid(3); $model = $this->subject->findByUid(1);
$image = $model->getImage(); $image = $model->getImage();
self::assertInstanceOf(FileReference::class, $image); self::assertInstanceOf(FileReference::class, $image);