Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Compatibility with TYPO3 v12 #25

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
check-composer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand All @@ -29,12 +29,12 @@ jobs:
strategy:
matrix:
php-version:
- 7.4
- 8.0
- 8.1
- 8.2
- 8.3
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand All @@ -50,7 +50,7 @@ jobs:
needs:
- check-composer
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
needs:
- check-composer
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand All @@ -106,16 +106,21 @@ jobs:
strategy:
matrix:
include:
- php-version: '7.4'
typo3-version: '^10.4'
- php-version: '7.4'
- php-version: '8.1'
typo3-version: '^11.5'
- php-version: '8.0'
- php-version: '8.2'
typo3-version: '^11.5'
- php-version: '8.1'
- php-version: '8.3'
typo3-version: '^11.5'
- php-version: '8.1'
typo3-version: '^12.4'
- php-version: '8.2'
typo3-version: '^12.4'
- php-version: '8.3'
typo3-version: '^12.4'

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand Down
19 changes: 8 additions & 11 deletions Tests/Functional/Caching/FlushViaDataHandlerChangesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@

namespace Sinso\Variables\Tests\Functional\Caching;

use Generator;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Sinso\Variables\Hooks\DataHandler;
Expand All @@ -37,9 +40,7 @@ class FlushViaDataHandlerChangesTest extends FunctionalTestCase
{
use ProphecyTrait;

/**
* @test
*/
#[Test]
public function canBeCreated(): void
{
$subject = new DataHandler();
Expand All @@ -50,10 +51,8 @@ public function canBeCreated(): void
);
}

/**
* @test
* @dataProvider possibleNoneTriggeringParams
*/
#[Test]
#[DataProvider('possibleNoneTriggeringParams')]
public function doesNotInteractWithCacheManagerOnUnkownData(array $params): void
{
$cacheManager = $this->prophesize(CacheManager::class);
Expand All @@ -68,7 +67,7 @@ public function doesNotInteractWithCacheManagerOnUnkownData(array $params): void
/**
* @return Generator<string,array{params:array}|array{params:array<string,string>}>
*/
public function possibleNoneTriggeringParams(): \Generator
public static function possibleNoneTriggeringParams(): Generator
{
yield 'no table given' => [
'params' => [],
Expand All @@ -87,9 +86,7 @@ public function possibleNoneTriggeringParams(): \Generator
];
}

/**
* @test
*/
#[Test]
public function flushCachesByGroupForMarker(): void
{
$cacheManager = $this->prophesize(CacheManager::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@

class NotImplementingInterface
{

}
19 changes: 17 additions & 2 deletions Tests/Functional/Frontend/AbstractProcessesMarkersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,34 @@

namespace Sinso\Variables\Tests\Functional\Frontend;

use TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend;
use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\InternalRequest;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

abstract class AbstractProcessesMarkersTest extends FunctionalTestCase
{
protected $testExtensionsToLoad = [

protected array $testExtensionsToLoad = [
'typo3conf/ext/variables',
];

protected $pathsToLinkInTestInstance = [
protected array $pathsToLinkInTestInstance = [
'typo3conf/ext/variables/Tests/Functional/Fixtures/Frontend/Sites/' => 'typo3conf/sites',
];

protected array $configurationToUseInTestInstance = [
'SYS' => [
'caching' => [
'cacheConfigurations' => [
// Set pages cache database backend, testing-framework sets this to NullBackend by default.
'pages' => [
'backend' => Typo3DatabaseBackend::class,
],
],
],
],
];

protected function setUp(): void
{
parent::setUp();
Expand Down
7 changes: 3 additions & 4 deletions Tests/Functional/Frontend/BreaksOnInvalidHookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@

namespace Sinso\Variables\Tests\Functional\Frontend;

use PHPUnit\Framework\Attributes\Test;
use Sinso\Variables\Tests\Functional\Fixtures\Frontend\Hook\NotImplementingInterface;

/**
* @covers \Sinso\Variables\Hooks\ContentProcessor
*/
class BreaksOnInvalidHookTest extends AbstractProcessesMarkersTest
{
protected $configurationToUseInTestInstance = [
protected array $configurationToUseInTestInstance = [
'EXTCONF' => [
'variables' => [
'postProcessMarkers' => [
Expand All @@ -40,9 +41,7 @@ class BreaksOnInvalidHookTest extends AbstractProcessesMarkersTest
],
];

/**
* @test
*/
#[Test]
public function throwsExceptionIfConfiguredClassDoesntImplementInterface(): void
{
$this->expectException(\RuntimeException::class);
Expand Down
7 changes: 3 additions & 4 deletions Tests/Functional/Frontend/ProcessesMarkersHookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@

namespace Sinso\Variables\Tests\Functional\Frontend;

use PHPUnit\Framework\Attributes\Test;
use Sinso\Variables\Tests\Functional\Fixtures\Frontend\Hook\ImplementingInterface;

/**
* @covers \Sinso\Variables\Hooks\ContentProcessor
*/
class ProcessesMarkersHookTest extends AbstractProcessesMarkersTest
{
protected $configurationToUseInTestInstance = [
protected array $configurationToUseInTestInstance = [
'EXTCONF' => [
'variables' => [
'postProcessMarkers' => [
Expand All @@ -40,9 +41,7 @@ class ProcessesMarkersHookTest extends AbstractProcessesMarkersTest
],
];

/**
* @test
*/
#[Test]
public function executesHookClass(): void
{
$this->importDataSet('EXT:variables/Tests/Functional/Fixtures/Frontend/Marker.xml');
Expand Down
19 changes: 7 additions & 12 deletions Tests/Functional/Frontend/ProcessesMarkersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@

namespace Sinso\Variables\Tests\Functional\Frontend;

use PHPUnit\Framework\Attributes\Test;

/**
* @covers \Sinso\Variables\Hooks\ContentProcessor
*/
class ProcessesMarkersTest extends AbstractProcessesMarkersTest
{
/**
* @test
*/

#[Test]
public function noMarkerAppliedAsNoneExist(): void
{
self::assertStringContainsString(
Expand All @@ -42,9 +43,7 @@ public function noMarkerAppliedAsNoneExist(): void
self::assertCount(1, $pageCache);
}

/**
* @test
*/
#[Test]
public function appliesMarkersStoredOnSamePage(): void
{
$this->importDataSet('EXT:variables/Tests/Functional/Fixtures/Frontend/Marker.xml');
Expand All @@ -59,9 +58,7 @@ public function appliesMarkersStoredOnSamePage(): void
self::assertSame('tx_variables_key_hash_b3560bb929f682dcc19c903256f98639', $pageCache[0]['tag']);
}

/**
* @test
*/
#[Test]
public function appliesMarkersFromRootlinePage(): void
{
$this->importDataSet('EXT:variables/Tests/Functional/Fixtures/Frontend/Marker.xml');
Expand All @@ -77,9 +74,7 @@ public function appliesMarkersFromRootlinePage(): void
self::assertSame('tx_variables_key_hash_7324efb2ab7ff6e7ef0fe77210ff6b20', $pageCache[1]['tag']);
}

/**
* @test
*/
#[Test]
public function appliesMarkersFromConfiguredStoragePid(): void
{
$this->importDataSet('EXT:variables/Tests/Functional/Fixtures/Frontend/Marker.xml');
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
}
},
"require": {
"typo3/cms-core": "^10.4 || ^11.5",
"php": "~7.4.0 || ~8.0.0 || ~8.1.0"
"typo3/cms-core": "^11.5 || ^12.4",
"php": "~8.1.0 || ~8.2.0 || ~8.3.0"
},
"require-dev": {
"rector/rector": "^0.12.23",
"typo3/testing-framework": "^6.16",
"typo3/testing-framework": "^7.0",
"phpspec/prophecy-phpunit": "^2.0",
"symplify/easy-coding-standard": "^10.2"
},
Expand All @@ -41,4 +41,4 @@
"[ -L .Build/web/typo3conf/ext/variables ] || ln -snvf ../../../../. .Build/web/typo3conf/ext/variables"
]
}
}
}
10 changes: 0 additions & 10 deletions ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,4 @@
'author' => 'Xavier Perseguers',
'author_email' => '[email protected]',
'author_company' => 'Swisscom (Schweiz) AG',
'constraints' => [
'depends' => [
'typo3' => '9.5.0-9.5.99',
'php' => '7.0.0-7.2.99',
],
'conflicts' => [
],
'suggests' => [
],
]
];
9 changes: 2 additions & 7 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/typo3/testing-framework/Resources/Core/Build/FunctionalTestsBootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertWarningsToExceptions="true"
forceCoversAnnotation="false"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
verbose="false"
>

<testsuites>
Expand All @@ -23,11 +18,11 @@
</testsuite>
</testsuites>

<coverage>
<source>
<include>
<directory suffix=".php">Classes</directory>
</include>
</coverage>
</source>

<php>
<env name="typo3DatabaseDriver" value="pdo_sqlite"/>
Expand Down
Loading