diff --git a/Tests/Functional/Caching/FlushViaDataHandlerChangesTest.php b/Tests/Functional/Caching/FlushViaDataHandlerChangesTest.php index f8b8e7b..3bf4797 100644 --- a/Tests/Functional/Caching/FlushViaDataHandlerChangesTest.php +++ b/Tests/Functional/Caching/FlushViaDataHandlerChangesTest.php @@ -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; @@ -37,9 +40,7 @@ class FlushViaDataHandlerChangesTest extends FunctionalTestCase { use ProphecyTrait; - /** - * @test - */ + #[Test] public function canBeCreated(): void { $subject = new DataHandler(); @@ -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); @@ -68,7 +67,7 @@ public function doesNotInteractWithCacheManagerOnUnkownData(array $params): void /** * @return Generator}> */ - public function possibleNoneTriggeringParams(): \Generator + public static function possibleNoneTriggeringParams(): Generator { yield 'no table given' => [ 'params' => [], @@ -87,9 +86,7 @@ public function possibleNoneTriggeringParams(): \Generator ]; } - /** - * @test - */ + #[Test] public function flushCachesByGroupForMarker(): void { $cacheManager = $this->prophesize(CacheManager::class); diff --git a/Tests/Functional/Frontend/AbstractProcessesMarkersTest.php b/Tests/Functional/Frontend/AbstractProcessesMarkersTest.php index 332e646..c647543 100644 --- a/Tests/Functional/Frontend/AbstractProcessesMarkersTest.php +++ b/Tests/Functional/Frontend/AbstractProcessesMarkersTest.php @@ -23,11 +23,13 @@ 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 array $testExtensionsToLoad = [ 'typo3conf/ext/variables', ]; @@ -36,6 +38,19 @@ abstract class AbstractProcessesMarkersTest extends FunctionalTestCase '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(); diff --git a/Tests/Functional/Frontend/BreaksOnInvalidHookTest.php b/Tests/Functional/Frontend/BreaksOnInvalidHookTest.php index 6c38b8a..d12df14 100644 --- a/Tests/Functional/Frontend/BreaksOnInvalidHookTest.php +++ b/Tests/Functional/Frontend/BreaksOnInvalidHookTest.php @@ -23,6 +23,7 @@ namespace Sinso\Variables\Tests\Functional\Frontend; +use PHPUnit\Framework\Attributes\Test; use Sinso\Variables\Tests\Functional\Fixtures\Frontend\Hook\NotImplementingInterface; /** @@ -40,7 +41,8 @@ class BreaksOnInvalidHookTest extends AbstractProcessesMarkersTest ], ]; - public function testThrowsExceptionIfConfiguredClassDoesntImplementInterface(): void + #[Test] + public function throwsExceptionIfConfiguredClassDoesntImplementInterface(): void { $this->expectException(\RuntimeException::class); $this->expectExceptionMessage('Sinso\Variables\Tests\Functional\Fixtures\Frontend\Hook\NotImplementingInterface does not implement Sinso\Variables\Hooks\MarkersProcessorInterface'); diff --git a/Tests/Functional/Frontend/ProcessesMarkersHookTest.php b/Tests/Functional/Frontend/ProcessesMarkersHookTest.php index 22f0d7c..2924ff4 100644 --- a/Tests/Functional/Frontend/ProcessesMarkersHookTest.php +++ b/Tests/Functional/Frontend/ProcessesMarkersHookTest.php @@ -23,6 +23,7 @@ namespace Sinso\Variables\Tests\Functional\Frontend; +use PHPUnit\Framework\Attributes\Test; use Sinso\Variables\Tests\Functional\Fixtures\Frontend\Hook\ImplementingInterface; /** @@ -40,7 +41,8 @@ class ProcessesMarkersHookTest extends AbstractProcessesMarkersTest ], ]; - public function testExecutesHookClass(): void + #[Test] + public function executesHookClass(): void { $this->importDataSet('EXT:variables/Tests/Functional/Fixtures/Frontend/Marker.xml'); diff --git a/Tests/Functional/Frontend/ProcessesMarkersTest.php b/Tests/Functional/Frontend/ProcessesMarkersTest.php index 7b01a7d..f199160 100644 --- a/Tests/Functional/Frontend/ProcessesMarkersTest.php +++ b/Tests/Functional/Frontend/ProcessesMarkersTest.php @@ -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( @@ -42,7 +43,8 @@ public function noMarkerAppliedAsNoneExist(): void self::assertCount(1, $pageCache); } - public function testAppliesMarkersStoredOnSamePage(): void + #[Test] + public function appliesMarkersStoredOnSamePage(): void { $this->importDataSet('EXT:variables/Tests/Functional/Fixtures/Frontend/Marker.xml'); @@ -56,7 +58,8 @@ public function testAppliesMarkersStoredOnSamePage(): void self::assertSame('tx_variables_key_hash_b3560bb929f682dcc19c903256f98639', $pageCache[0]['tag']); } - public function testAppliesMarkersFromRootlinePage(): void + #[Test] + public function appliesMarkersFromRootlinePage(): void { $this->importDataSet('EXT:variables/Tests/Functional/Fixtures/Frontend/Marker.xml'); @@ -71,7 +74,8 @@ public function testAppliesMarkersFromRootlinePage(): void self::assertSame('tx_variables_key_hash_7324efb2ab7ff6e7ef0fe77210ff6b20', $pageCache[1]['tag']); } - public function testAppliesMarkersFromConfiguredStoragePid(): void + #[Test] + public function appliesMarkersFromConfiguredStoragePid(): void { $this->importDataSet('EXT:variables/Tests/Functional/Fixtures/Frontend/Marker.xml'); diff --git a/composer.json b/composer.json index 8c01e4f..b6ca44e 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ }, "require-dev": { "rector/rector": "^0.12.23", - "typo3/testing-framework": "^6.0 || ^7.0", + "typo3/testing-framework": "^7.0", "phpspec/prophecy-phpunit": "^2.0", "symplify/easy-coding-standard": "^10.2" },