diff --git a/composer.json b/composer.json
index d996f0d..3379f8e 100644
--- a/composer.json
+++ b/composer.json
@@ -8,15 +8,15 @@
"cwp"
],
"require": {
- "php": ">=7.1.0",
- "silverstripe/framework": "^4.7",
+ "php": "^7.3 || ^8.0",
+ "silverstripe/framework": "^4.10",
"silverstripe/admin": "^1.7",
"silverstripe/hybridsessions": "^2",
"silverstripe/environmentcheck": "^2",
"silverstripe/auditor": "^2"
},
"require-dev": {
- "sminnee/phpunit": "^5.7",
+ "phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3"
},
"autoload": {
diff --git a/tests/AtomFeedTest.php b/tests/AtomFeedTest.php
index 5795cbd..32755e0 100644
--- a/tests/AtomFeedTest.php
+++ b/tests/AtomFeedTest.php
@@ -32,17 +32,17 @@ public function testAtomFeed()
$content = $atomFeed->outputToBrowser();
//Debug::message($content);
- $this->assertContains('', $content);
- $this->assertContains('', $content);
- $this->assertContains('', $content);
+ $this->assertStringContainsString('', $content);
+ $this->assertStringContainsString('', $content);
+ $this->assertStringContainsString('', $content);
- $this->assertContains('
ItemA', $content);
- $this->assertContains('ItemB', $content);
- $this->assertContains('ItemC', $content);
+ $this->assertStringContainsString('ItemA', $content);
+ $this->assertStringContainsString('ItemB', $content);
+ $this->assertStringContainsString('ItemC', $content);
- $this->assertContains("\tItemA Content\n", $content);
- $this->assertContains("\tItemB Content\n", $content);
- $this->assertContains("\tItemC Content\n", $content);
+ $this->assertStringContainsString("\tItemA Content\n", $content);
+ $this->assertStringContainsString("\tItemB Content\n", $content);
+ $this->assertStringContainsString("\tItemC Content\n", $content);
}
public function testRenderWithTemplate()
@@ -50,18 +50,18 @@ public function testRenderWithTemplate()
$atomFeed = new CwpAtomFeed(new ArrayList(), "", "", "");
$content = $atomFeed->outputToBrowser();
// test we have switched from a RSS feed test template tot he AtomFeed template
- $this->assertNotContains('Test Custom Template', $content);
+ $this->assertStringNotContainsString('Test Custom Template', $content);
}
public function testLinkToFeed()
{
$link = AtomTagsStub::linkToFeed('atomLinkUrl', 'Atom feed of this blog');
- $this->assertContains('atomLinkUrl', $link);
- $this->assertContains('Atom feed of this blog', $link);
- $this->assertContains('application/atom+xml', $link);
+ $this->assertStringContainsString('atomLinkUrl', $link);
+ $this->assertStringContainsString('Atom feed of this blog', $link);
+ $this->assertStringContainsString('application/atom+xml', $link);
}
- protected function setUp()
+ protected function setUp(): void
{
parent::setUp();
Config::modify()->set(Director::class, 'alternate_base_url', '/');
@@ -71,7 +71,7 @@ protected function setUp()
$_SERVER['HTTP_HOST'] = 'www.example.org';
}
- protected function tearDown()
+ protected function tearDown(): void
{
parent::tearDown();
Config::modify()->set(Director::class, 'alternate_base_url', null);
diff --git a/tests/Control/CwpBasicAuthMiddlewareTest.php b/tests/Control/CwpBasicAuthMiddlewareTest.php
index aa30a16..31cdee3 100644
--- a/tests/Control/CwpBasicAuthMiddlewareTest.php
+++ b/tests/Control/CwpBasicAuthMiddlewareTest.php
@@ -23,7 +23,7 @@ class CwpBasicAuthMiddlewareTest extends SapphireTest
*/
protected $originalServersVars = [];
- protected function setUp()
+ protected function setUp(): void
{
parent::setUp();
@@ -33,7 +33,7 @@ protected function setUp()
Config::modify()->set(BasicAuth::class, 'ignore_cli', false);
}
- protected function tearDown()
+ protected function tearDown(): void
{
$_SERVER = $this->originalServersVars;
diff --git a/tests/Control/InitialisationMiddlewareTest.php b/tests/Control/InitialisationMiddlewareTest.php
index cc11f4f..bc755f2 100644
--- a/tests/Control/InitialisationMiddlewareTest.php
+++ b/tests/Control/InitialisationMiddlewareTest.php
@@ -22,7 +22,7 @@ class InitialisationMiddlewareTest extends FunctionalTest
protected $usesDatabase = true;
- protected function setUp()
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/Extension/CWPVersionExtensionTest.php b/tests/Extension/CWPVersionExtensionTest.php
index 124ce36..8f9b25f 100644
--- a/tests/Extension/CWPVersionExtensionTest.php
+++ b/tests/Extension/CWPVersionExtensionTest.php
@@ -20,7 +20,7 @@ class CWPVersionExtensionTest extends SapphireTest
*/
protected $leftAndMain;
- protected function setUp()
+ protected function setUp(): void
{
parent::setUp();
diff --git a/tests/PasswordEncryptor/PBKDF2Test.php b/tests/PasswordEncryptor/PBKDF2Test.php
index ac0b8fa..f491e42 100644
--- a/tests/PasswordEncryptor/PBKDF2Test.php
+++ b/tests/PasswordEncryptor/PBKDF2Test.php
@@ -26,12 +26,10 @@ public function testEncrypt()
);
}
- /**
- * @expectedException Exception
- * @expectedExceptionMessage Hash algorithm "foobar" not found
- */
public function testThrowsExceptionWhenInvalidAlgorithmIsProvided()
{
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('Hash algorithm "foobar" not found in hash_algos()');
new PBKDF2('foobar');
}
}