From 13b111653260d316a34952eea62a4a3454f40bb4 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 30 Jul 2024 19:51:15 +0200 Subject: [PATCH] Fix broken functional test SQLite does reset the UID autoincrement during deletion. That way the assertions do not match. We now use a different set up and remove the uids from assertions. That way we still ensure that the imported data is removed and new data is imported. We do not need to care about UID. --- Tests/Functional/Command/CreateTestDataCommandTest.php | 2 +- Tests/Functional/Command/Fixtures/Database/ExistingTeas.csv | 4 ++++ .../Command/Fixtures/Database/TeasAfterDelete.csv | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 Tests/Functional/Command/Fixtures/Database/ExistingTeas.csv diff --git a/Tests/Functional/Command/CreateTestDataCommandTest.php b/Tests/Functional/Command/CreateTestDataCommandTest.php index 30bdb09..400a543 100644 --- a/Tests/Functional/Command/CreateTestDataCommandTest.php +++ b/Tests/Functional/Command/CreateTestDataCommandTest.php @@ -92,7 +92,7 @@ class CreateTestDataCommandTest extends FunctionalTestCase */ public function testDataGetsDeletedBeforeNewDataCreated(): void { - $this->importCSVDataSet(__DIR__ . '/Fixtures/Database/Teas.csv'); + $this->importCSVDataSet(__DIR__ . '/Fixtures/Database/ExistingTeas.csv'); $this->commandTester->execute( [ 'pageUid' => '1', diff --git a/Tests/Functional/Command/Fixtures/Database/ExistingTeas.csv b/Tests/Functional/Command/Fixtures/Database/ExistingTeas.csv new file mode 100644 index 0000000..e1dd287 --- /dev/null +++ b/Tests/Functional/Command/Fixtures/Database/ExistingTeas.csv @@ -0,0 +1,4 @@ +"tx_tea_domain_model_tea" +,"uid","pid","title","description","deleted" +,1,1,"Darjeeling","Which already existed in the system",0 +,2,1,"Earl Grey","Which already existed in the system",0 diff --git a/Tests/Functional/Command/Fixtures/Database/TeasAfterDelete.csv b/Tests/Functional/Command/Fixtures/Database/TeasAfterDelete.csv index 3967dcd..c0a2aec 100644 --- a/Tests/Functional/Command/Fixtures/Database/TeasAfterDelete.csv +++ b/Tests/Functional/Command/Fixtures/Database/TeasAfterDelete.csv @@ -1,4 +1,4 @@ "tx_tea_domain_model_tea" -,"uid","pid","title","description","deleted" -,3,1,"Darjeeling","I love that tea!",0 -,4,1,"Earl Grey","A nice tea!",0 +,"pid","title","description","deleted" +,1,"Darjeeling","I love that tea!",0 +,1,"Earl Grey","A nice tea!",0