From d070de74cdb2b52a2433f6d51a63e05c9bc1e75b Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 10 Sep 2024 18:10:06 +1200 Subject: [PATCH] DEP Use PHPUnit 11 --- composer.json | 2 +- tests/CookieStoreTest.php | 7 ++++++- tests/DatabaseStoreTest.php | 7 ++++++- tests/{AbstractTest.php => HybridSessionsTestTrait.php} | 4 +--- tests/OpenSSLCryptoTest.php | 5 ++--- 5 files changed, 16 insertions(+), 9 deletions(-) rename tests/{AbstractTest.php => HybridSessionsTestTrait.php} (97%) diff --git a/composer.json b/composer.json index 4608ecb..55b8d76 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "silverstripe/framework": "^6" }, "require-dev": { - "phpunit/phpunit": "^9.6", + "phpunit/phpunit": "^11.3", "squizlabs/php_codesniffer": "^3", "silverstripe/versioned": "^3", "silverstripe/standards": "^1", diff --git a/tests/CookieStoreTest.php b/tests/CookieStoreTest.php index dc3ab28..71c0234 100644 --- a/tests/CookieStoreTest.php +++ b/tests/CookieStoreTest.php @@ -6,9 +6,14 @@ use SilverStripe\Core\TempFolder; use SilverStripe\HybridSessions\Store\CookieStore; use SilverStripe\HybridSessions\Tests\Store\TestCookieStore; +use SilverStripe\Dev\SapphireTest; -class CookieStoreTest extends AbstractTest +class CookieStoreTest extends SapphireTest { + use HybridSessionsTestTrait; + + protected $usesDatabase = true; + protected function getStore() { $store = Injector::inst()->get(CookieStore::class); diff --git a/tests/DatabaseStoreTest.php b/tests/DatabaseStoreTest.php index 98a681c..8213199 100644 --- a/tests/DatabaseStoreTest.php +++ b/tests/DatabaseStoreTest.php @@ -6,9 +6,14 @@ use SilverStripe\ORM\Connect\MySQLDatabase; use SilverStripe\Core\Injector\Injector; use SilverStripe\HybridSessions\Store\DatabaseStore; +use SilverStripe\Dev\SapphireTest; -class DatabaseStoreTest extends AbstractTest +class DatabaseStoreTest extends SapphireTest { + use HybridSessionsTestTrait; + + protected $usesDatabase = true; + protected function setUp(): void { parent::setUp(); diff --git a/tests/AbstractTest.php b/tests/HybridSessionsTestTrait.php similarity index 97% rename from tests/AbstractTest.php rename to tests/HybridSessionsTestTrait.php index 29e6a91..ffa8ea4 100644 --- a/tests/AbstractTest.php +++ b/tests/HybridSessionsTestTrait.php @@ -8,10 +8,8 @@ use SilverStripe\HybridSessions\Store\CookieStore; use SilverStripe\HybridSessions\Tests\Store\TestCookieStore; -abstract class AbstractTest extends SapphireTest +trait HybridSessionsTestTrait { - protected $usesDatabase = true; - protected function setUp(): void { parent::setUp(); diff --git a/tests/OpenSSLCryptoTest.php b/tests/OpenSSLCryptoTest.php index 3d02dde..443fce7 100644 --- a/tests/OpenSSLCryptoTest.php +++ b/tests/OpenSSLCryptoTest.php @@ -4,10 +4,9 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\HybridSessions\Crypto\OpenSSLCrypto; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; -/** - * @requires extension openssl - */ +#[RequiresPhpExtension('openssl')] class OpenSSLCryptoTest extends SapphireTest { public function testIntegrity()