Skip to content

Commit

Permalink
[TASK] run content_defender tests on v13
Browse files Browse the repository at this point in the history
  • Loading branch information
achimfritz committed Dec 18, 2024
1 parent 89a603b commit b655f07
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 37 deletions.
4 changes: 2 additions & 2 deletions Build/Scripts/runTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ case ${TEST_SUITE} in
composer require typo3/cms-core:^11.5 ichhabrecht/content-defender --dev -W --no-progress --no-interaction
composer prepare-tests
elif [ ${TYPO3} -eq 13 ]; then
composer require typo3/cms-core:^13.4 --dev -W --no-progress --no-interaction
composer require typo3/cms-core:^13.4 ichhabrecht/content-defender --dev -W --no-progress --no-interaction
composer prepare-tests
else
composer require typo3/cms-core:^12.4 ichhabrecht/content-defender --dev -W --no-progress --no-interaction
Expand All @@ -620,7 +620,7 @@ case ${TEST_SUITE} in
composer require typo3/cms-core:^11.5 ichhabrecht/content-defender --dev -W --no-progress --no-interaction
composer prepare-tests
elif [ ${TYPO3} -eq 13 ]; then
composer require typo3/cms-core:^13.0 --dev -W --no-progress --no-interaction
composer require typo3/cms-core:^13.4 ichhabrecht/content-defender --dev -W --no-progress --no-interaction
composer prepare-tests
else
composer require typo3/cms-core:^12.4 ichhabrecht/content-defender --dev -W --no-progress --no-interaction
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);

namespace B13\Container\Tests\Functional\Datahandler\ContentDefender;

/*
* This file is part of TYPO3 CMS-based extension "container" by b13.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*/

use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler;
use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder;
use TYPO3\CMS\Core\Http\ServerRequest;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Utility\GeneralUtility;

abstract class AbstractContentDefender extends AbstractDatahandler
{
protected function setUp(): void
{
parent::setUp();
if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() === 12) {
// content_defender calls FormDataCompiler which wants access global variable TYPO3_REQUEST
$GLOBALS['TYPO3_REQUEST'] = null;
} elseif ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() > 12) {
// content_defender always returns true for restrictions if global variable TYPO3_REQUEST is nulla
$GLOBALS['TYPO3_REQUEST'] = (new ServerRequest())->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_BE);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@
* of the License, or any later version.
*/

use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Utility\GeneralUtility;

class CopyContainerTest extends AbstractDatahandler
class CopyContainerTest extends AbstractContentDefender
{
/**
* @var non-empty-string[]
Expand All @@ -30,10 +26,6 @@ class CopyContainerTest extends AbstractDatahandler
protected function setUp(): void
{
parent::setUp();
if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() > 11) {
// content_defender calls FormDataCompiler which wants access global variable TYPO3_REQUEST
$GLOBALS['TYPO3_REQUEST'] = null;
}
$this->importCSVDataSet(__DIR__ . '/Fixtures/copy_container.csv');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@
* of the License, or any later version.
*/

use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Utility\GeneralUtility;

class DefaultLanguageTest extends AbstractDatahandler
class DefaultLanguageTest extends AbstractContentDefender
{
/**
* @var non-empty-string[]
Expand All @@ -30,10 +26,6 @@ class DefaultLanguageTest extends AbstractDatahandler
protected function setUp(): void
{
parent::setUp();
if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() > 11) {
// content_defender calls FormDataCompiler which wants access global variable TYPO3_REQUEST
$GLOBALS['TYPO3_REQUEST'] = null;
}
$this->importCSVDataSet(__DIR__ . '/Fixtures/DefaultLanguage/setup.csv');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@
* of the License, or any later version.
*/

use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Utility\GeneralUtility;

class LocalizationTest extends AbstractDatahandler
class LocalizationTest extends AbstractContentDefender
{
/**
* @var non-empty-string[]
Expand All @@ -30,10 +26,6 @@ class LocalizationTest extends AbstractDatahandler
protected function setUp(): void
{
parent::setUp();
if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() > 11) {
// content_defender calls FormDataCompiler which wants access global variable TYPO3_REQUEST
$GLOBALS['TYPO3_REQUEST'] = null;
}
$this->importCSVDataSet(__DIR__ . '/Fixtures/Localization/setup.csv');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@
* of the License, or any later version.
*/

use B13\Container\Tests\Functional\Datahandler\AbstractDatahandler;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\StringUtility;

class MaxItemsTest extends AbstractDatahandler
class MaxItemsTest extends AbstractContentDefender
{
/**
* @var non-empty-string[]
Expand All @@ -31,10 +28,6 @@ class MaxItemsTest extends AbstractDatahandler
protected function setUp(): void
{
parent::setUp();
if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() > 11) {
// content_defender calls FormDataCompiler which wants access global variable TYPO3_REQUEST
$GLOBALS['TYPO3_REQUEST'] = null;
}
$this->linkSiteConfigurationIntoTestInstance();
}

Expand Down

0 comments on commit b655f07

Please sign in to comment.