Commit fc0b72ca authored by Christian Kuhn's avatar Christian Kuhn
Browse files

[TASK] Avoid setting assertCleanReferenceIndex to false in tests

Functional tests that extend AbstractDataHandlerActionTestCase
test for correct sys_refindex in tearDown(). This can
be avoided by setting assertCleanReferenceIndex to false,
which is only a temporary solution until reference updating
fully works.

The patch changes some import fixtures that come without
proper sys_refindex rows to avoid setting this property
to false.

One last call needs a dedicated bug fix and will have a
dedicated patch.

Change-Id: I7daa4d961372812312389dda7af13a5ac9fe8cef
Resolves: #96074
Releases: master, 11.5
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72284


Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Jochen's avatarJochen <rothjochen@gmail.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Jochen's avatarJochen <rothjochen@gmail.com>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 1643c457
......@@ -39,4 +39,34 @@
<sorting>3</sorting>
<colPos>1</colPos>
</tt_content>
<sys_refindex>
<hash>9039d2edd769c4f4007cdddf25059d9d</hash>
<tablename>tt_content</tablename>
<recuid>4</recuid>
<field>l18n_parent</field>
<sorting>0</sorting>
<workspace>0</workspace>
<ref_table>tt_content</ref_table>
<ref_uid>1</ref_uid>
</sys_refindex>
<sys_refindex>
<hash>65555a45353c129720929d952fb9be88</hash>
<tablename>tt_content</tablename>
<recuid>5</recuid>
<field>l18n_parent</field>
<sorting>0</sorting>
<workspace>0</workspace>
<ref_table>tt_content</ref_table>
<ref_uid>2</ref_uid>
</sys_refindex>
<sys_refindex>
<hash>89323cfcf5521069f7344a6ef72353f2</hash>
<tablename>tt_content</tablename>
<recuid>6</recuid>
<field>l18n_parent</field>
<sorting>0</sorting>
<workspace>0</workspace>
<ref_table>tt_content</ref_table>
<ref_uid>3</ref_uid>
</sys_refindex>
</dataset>
......@@ -42,12 +42,6 @@ class LocalizationControllerTest extends AbstractDataHandlerActionTestCase
*/
protected $backendUser;
/**
* @var bool
* @todo: Test setup should be updated to have true here
*/
protected $assertCleanReferenceIndex = false;
/**
* @var array
*/
......
......@@ -35,11 +35,6 @@ class HookTest extends AbstractDataHandlerActionTestCase
const FIELD_ContentHotel = 'tx_testirreforeignfield_hotels';
const FIELD_Categories = 'categories';
/**
* @var bool Reference index testing is not relevant here
*/
protected $assertCleanReferenceIndex = false;
/**
* @var HookFixture
*/
......@@ -77,6 +72,15 @@ class HookTest extends AbstractDataHandlerActionTestCase
unset($this->hookFixture);
}
/**
* @test
*/
public function verifyCleanReferenceIndex(): void
{
// The test verifies the imported data set has a clean reference index by the check in tearDown()
self::assertTrue(true);
}
/**
* @test
*/
......@@ -241,7 +245,7 @@ class HookTest extends AbstractDataHandlerActionTestCase
self::VALUE_ContentId,
[
'header' => 'Testing #1',
self::FIELD_ContentHotel => '3,4,5',
self::FIELD_ContentHotel => '3,4',
self::FIELD_Categories => '28,29,30',
]
);
......@@ -258,7 +262,7 @@ class HookTest extends AbstractDataHandlerActionTestCase
'table' => self::TABLE_Content,
'fieldArray' => [
'header' => 'Testing #1',
self::FIELD_ContentHotel => '3,4,5',
self::FIELD_ContentHotel => '3,4',
self::FIELD_Categories => '28,29,30',
],
],
......@@ -273,7 +277,7 @@ class HookTest extends AbstractDataHandlerActionTestCase
'table' => self::TABLE_Content,
'fieldArray' => [
'header' => 'Testing #1',
self::FIELD_ContentHotel => 3,
self::FIELD_ContentHotel => 2,
self::FIELD_Categories => 3,
],
],
......
......@@ -35,23 +35,25 @@ class ActionTest extends AbstractDataHandlerActionTestCase
*/
protected $scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/FlexformIrre/DataSet/';
/**
* @var bool
* @todo: Test setup should be updated to have true here
*/
protected $assertCleanReferenceIndex = false;
protected $testExtensionsToLoad = [
'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_irre_foreignfield',
];
/**
* @test
*/
public function verifyCleanReferenceIndex(): void
{
// The test verifies the imported data set has a clean reference index by the check in tearDown()
self::assertTrue(true);
}
/**
* @test
*/
public function newVersionOfFileRelationInFlexformFieldIsCreatedOnSave(): void
{
$this->importScenarioDataSet('LiveDefaultPages');
$this->importScenarioDataSet('LiveDefaultElements');
$this->importScenarioDataSet('ImportDefault');
$this->setWorkspaceId(1);
$this->getActionService()->modifyRecords(1, [
//'sys_file_reference' => ['uid' => 10, 'hidden' => 0],
......
"pages",,,,,,,,,,,,,,
,"uid","pid","sorting","deleted","t3_origuid","t3ver_wsid","t3ver_state","t3ver_stage","t3ver_oid","title",,,,
,1,0,256,0,0,0,0,0,0,"DataHandlerTest",,,,
,2,1,256,0,0,0,0,0,0,"Second Test page",,,,
"sys_language",,,,,,,,,,,,,,
,"uid","pid","hidden","title","flag",,,,,,,,,
,1,0,0,"Deutsch","de",,,,,,,,,
......@@ -14,3 +18,9 @@
"sys_file_reference",,,,,,,,,,,,,,
,"uid","pid","uid_local","uid_foreign","tablenames","fieldname","sorting_foreign","table_local","t3ver_wsid","t3ver_state","t3ver_stage","t3ver_oid",,
,1,1,20,100,"tt_content","files",1,"sys_file",0,0,0,0,,
"sys_refindex",,,,,,,,,,,,,,
,"hash","tablename","recuid","field","flexpointer","softref_key","softref_id","sorting","workspace","ref_table","ref_uid","ref_string",,
,"0ad00e77a175a4a5d134cc2b115839fd","sys_file",20,"storage",,,,0,0,"sys_file_storage",1,,,
,"ba70fb18121c539edb3c4f20287907d1","sys_file_reference",1,"uid_local",,,,0,0,"sys_file",20,,,
,"db6d026c89fe7d3caa9d747b4f1f792f","tt_content",100,"tx_testirreforeignfield_flexform","sDEF/lDEF/files/vDEF/",,,0,0,"sys_file_reference",1,,,
,"e4712fb3d70caa07319ee0da0925cdb3","sys_workspace",1,"db_mountpoints",,,,0,0,"pages",88,,,
"pages",,,,,,,,,,
,"uid","pid","sorting","deleted","t3_origuid","t3ver_wsid","t3ver_state","t3ver_stage","t3ver_oid","title"
,1,0,256,0,0,0,0,0,0,"DataHandlerTest"
,2,1,256,0,0,0,0,0,0,"Second Test page"
......@@ -7,3 +7,9 @@
,16,13,0,0,1,15,15,0,0,0,0,0,"Dansk Page","/default-parent/dansk-page"
,17,13,0,0,2,15,15,0,0,0,0,0,"German Page","/german-parent/german-page"
,18,13,0,0,3,15,15,0,0,0,0,0,"Swiss Page","/german-parent/swiss-page"
"sys_refindex",,,,,,,,,,,,,,
,"hash","tablename","recuid","field","flexpointer","softref_key","softref_id","sorting","workspace","ref_table","ref_uid","ref_string",,
,"7bdc0fb33cd3f1a608fc0f7272a6bf66","pages",14,"l10n_parent",,,,0,0,"pages",13,,,
,"d02e4f1be2d090562dad18e97ef827c4","pages",16,"l10n_parent",,,,0,0,"pages",15,,,
,"e56568119b7c4c428b5ed98cdf4be3a6","pages",17,"l10n_parent",,,,0,0,"pages",15,,,
,"f6a6dd7cdc37b44e2321308636e78cb2","pages",18,"l10n_parent",,,,0,0,"pages",15,,,
......@@ -31,11 +31,6 @@ class SlugHelperTest extends AbstractDataHandlerActionTestCase
*/
protected $scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/Slug/DataSet/';
/**
* @var bool Reference index testing not relevant here.
*/
protected $assertCleanReferenceIndex = false;
/**
* Default Site Configuration
* @var array
......@@ -92,6 +87,15 @@ class SlugHelperTest extends AbstractDataHandlerActionTestCase
$this->setUpFrontendRootPage(1, ['typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.typoscript']);
}
/**
* @test
*/
public function verifyCleanReferenceIndex(): void
{
// The test verifies the imported data set has a clean reference index by the check in tearDown()
self::assertTrue(true);
}
/**
* DataProvider for testing the language resolving of the parent page.
* - If the language can be resolved, get the slug of the current language
......
......@@ -34,11 +34,6 @@ class EnableFieldsTest extends AbstractDataHandlerActionTestCase
*/
protected $testExtensionsToLoad = ['typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example'];
/**
* @var bool Reference index testing not relevant here.
*/
protected $assertCleanReferenceIndex = false;
/**
* Sets up this test suite.
*/
......
......@@ -32,4 +32,24 @@
<deleted>0</deleted>
<posts>0</posts>
</tx_blogexample_domain_model_blog>
<sys_refindex>
<hash>cb722646d5c745f583dc5e0f3de5f8ba</hash>
<tablename>tx_blogexample_domain_model_blog</tablename>
<recuid>2</recuid>
<field>fe_group</field>
<sorting>0</sorting>
<workspace>0</workspace>
<ref_table>fe_groups</ref_table>
<ref_uid>1</ref_uid>
</sys_refindex>
<sys_refindex>
<hash>584906a3be1faa5c4d1bfd6dd0328502</hash>
<tablename>tx_blogexample_domain_model_blog</tablename>
<recuid>3</recuid>
<field>fe_group</field>
<sorting>0</sorting>
<workspace>0</workspace>
<ref_table>fe_groups</ref_table>
<ref_uid>2</ref_uid>
</sys_refindex>
</dataset>
......@@ -34,4 +34,64 @@
<disable>0</disable>
<tx_extbase_type>ExtbaseTeam\BlogExample\Domain\Model\Administrator</tx_extbase_type>
</fe_users>
<sys_refindex>
<hash>001cd2e4390e0152274a1a31cabbf067</hash>
<tablename>fe_users</tablename>
<recuid>1</recuid>
<field>usergroup</field>
<sorting>0</sorting>
<workspace>0</workspace>
<ref_table>fe_groups</ref_table>
<ref_uid>1</ref_uid>
</sys_refindex>
<sys_refindex>
<hash>df54ed0e6e6fa030108438926d5c264f</hash>
<tablename>fe_users</tablename>
<recuid>2</recuid>
<field>usergroup</field>
<sorting>0</sorting>
<workspace>0</workspace>
<ref_table>fe_groups</ref_table>
<ref_uid>2</ref_uid>
</sys_refindex>
<sys_refindex>
<hash>121e4c7af1a67d742beae6f5495860d9</hash>
<tablename>fe_users</tablename>
<recuid>3</recuid>
<field>usergroup</field>
<sorting>0</sorting>
<workspace>0</workspace>
<ref_table>fe_groups</ref_table>
<ref_uid>1</ref_uid>
</sys_refindex>
<sys_refindex>
<hash>1ea5a92bdcf97a86381068c38080e25b</hash>
<tablename>fe_users</tablename>
<recuid>3</recuid>
<field>usergroup</field>
<sorting>1</sorting>
<workspace>0</workspace>
<ref_table>fe_groups</ref_table>
<ref_uid>2</ref_uid>
</sys_refindex>
<sys_refindex>
<hash>cca234ba287dceaefadd4e6eed797393</hash>
<tablename>fe_users</tablename>
<recuid>4</recuid>
<field>usergroup</field>
<sorting>0</sorting>
<workspace>0</workspace>
<ref_table>fe_groups</ref_table>
<ref_uid>1</ref_uid>
</sys_refindex>
<sys_refindex>
<hash>ff1fd3eb4edf533f313b5fba99f361f5</hash>
<tablename>fe_users</tablename>
<recuid>4</recuid>
<field>usergroup</field>
<sorting>1</sorting>
<workspace>0</workspace>
<ref_table>fe_groups</ref_table>
<ref_uid>2</ref_uid>
</sys_refindex>
</dataset>
......@@ -18,22 +18,14 @@ declare(strict_types=1);
namespace TYPO3\CMS\Install\Tests\Functional\Updates\RowUpdater;
use PHPUnit\Framework\MockObject\MockObject;
use TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Install\Updates\DatabaseRowsUpdateWizard;
use TYPO3\CMS\Install\Updates\RowUpdater\WorkspaceNewPlaceholderRemovalMigration;
use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\ActionService;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
class WorkspaceNewPlaceholderRemovalTest extends AbstractDataHandlerActionTestCase
class WorkspaceNewPlaceholderRemovalTest extends FunctionalTestCase
{
/**
* @var string
*/
protected $assertionDataSetDirectory = 'typo3/sysext/install/Tests/Functional/Updates/RowUpdater/Fixtures/';
/**
* @var string
*/
protected $scenarioDataSetDirectory = 'typo3/sysext/install/Tests/Functional/Updates/RowUpdater/Fixtures/';
protected $coreExtensionsToLoad = ['workspaces'];
/**
......@@ -44,11 +36,6 @@ class WorkspaceNewPlaceholderRemovalTest extends AbstractDataHandlerActionTestCa
'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_irre_csv',
];
/**
* @var bool Reference index will be broken after this row updater and is not checked.
*/
protected $assertCleanReferenceIndex = false;
/**
* @var MockObject|DatabaseRowsUpdateWizard|\TYPO3\TestingFramework\Core\AccessibleObjectInterface
*/
......@@ -57,7 +44,7 @@ class WorkspaceNewPlaceholderRemovalTest extends AbstractDataHandlerActionTestCa
protected function setUp(): void
{
parent::setUp();
$this->actionService = $this->getActionService();
$this->actionService = GeneralUtility::makeInstance(ActionService::class);
// Register only WorkspaceNewPlaceholderRemovalMigration in the row updater wizard
$this->subject = $this->getAccessibleMock(DatabaseRowsUpdateWizard::class, ['dummy']);
$this->subject->_set('rowUpdater', [WorkspaceNewPlaceholderRemovalMigration::class]);
......@@ -69,9 +56,9 @@ class WorkspaceNewPlaceholderRemovalTest extends AbstractDataHandlerActionTestCa
public function workspaceRecordsUpdatedWithIrreCsv(): void
{
// Data set inspired by workspaces IRRE/CSV/Modify/DataSet/copyPage.csv
$this->importScenarioDataSet('WorkspaceNewPlaceholderRemovalIrreCsvImport');
$this->importCSVDataSet(__DIR__ . '/Fixtures/WorkspaceNewPlaceholderRemovalIrreCsvImport.csv');
$this->subject->executeUpdate();
$this->assertAssertionDataSet('WorkspaceNewPlaceholderRemovalIrreCsvResult');
$this->assertCSVDataSet('typo3/sysext/install/Tests/Functional/Updates/RowUpdater/Fixtures/WorkspaceNewPlaceholderRemovalIrreCsvResult.csv');
}
/**
......@@ -80,9 +67,9 @@ class WorkspaceNewPlaceholderRemovalTest extends AbstractDataHandlerActionTestCa
public function workspaceRecordsUpdatedWithIrreForeignField(): void
{
// Data set inspired by workspaces IRRE/ForeignField/Modify/DataSet/copyPage.csv
$this->importScenarioDataSet('WorkspaceNewPlaceholderRemovalIrreForeignFieldImport');
$this->importCSVDataSet(__DIR__ . '/Fixtures/WorkspaceNewPlaceholderRemovalIrreForeignFieldImport.csv');
$this->subject->executeUpdate();
$this->assertAssertionDataSet('WorkspaceNewPlaceholderRemovalIrreForeignFieldResult');
$this->assertCSVDataSet('typo3/sysext/install/Tests/Functional/Updates/RowUpdater/Fixtures/WorkspaceNewPlaceholderRemovalIrreForeignFieldResult.csv');
}
/**
......@@ -91,8 +78,8 @@ class WorkspaceNewPlaceholderRemovalTest extends AbstractDataHandlerActionTestCa
public function workspaceRecordsUpdatedWithManyToMany(): void
{
// Data set inspired by workspaces ManyToMany/Modify/DataSet/copyPage.csv
$this->importScenarioDataSet('WorkspaceNewPlaceholderRemovalManyToManyImport');
$this->importCSVDataSet(__DIR__ . '/Fixtures/WorkspaceNewPlaceholderRemovalManyToManyImport.csv');
$this->subject->executeUpdate();
$this->assertAssertionDataSet('WorkspaceNewPlaceholderRemovalManyToManyResult');
$this->assertCSVDataSet('typo3/sysext/install/Tests/Functional/Updates/RowUpdater/Fixtures/WorkspaceNewPlaceholderRemovalManyToManyResult.csv');
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment