diff --git a/composer.json b/composer.json index cfa3040..aed7bf5 100644 --- a/composer.json +++ b/composer.json @@ -8,10 +8,11 @@ "email": "damian@silverstripe.com" }], "require": { + "php": "^7.3 || ^8.0", "silverstripe/comments": "^3.0" }, "require-dev": { - "sminnee/phpunit": "^5.7", + "phpunit/phpunit": "^9.5", "squizlabs/php_codesniffer": "^3.0" }, "autoload": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 0deb46e..1344dac 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,8 +1,9 @@ - - tests - - + + + tests + + src/ diff --git a/tests/CommentNotifiableTest.php b/tests/CommentNotifiableTest.php index 1c750a3..b72d7a7 100644 --- a/tests/CommentNotifiableTest.php +++ b/tests/CommentNotifiableTest.php @@ -19,7 +19,7 @@ class CommentNotifiableTest extends SapphireTest CommentNotifiableTestDataObject::class ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -29,7 +29,7 @@ protected function setUp() $_SERVER['HTTP_HOST'] = 'www.mysite.com'; } - protected function tearDown() + protected function tearDown(): void { $_SERVER['HTTP_HOST'] = $this->oldhost; diff --git a/tests/CommentNotifierTest.php b/tests/CommentNotifierTest.php index c5bc584..ffa5608 100644 --- a/tests/CommentNotifierTest.php +++ b/tests/CommentNotifierTest.php @@ -24,7 +24,7 @@ class CommentNotifierTest extends SapphireTest CommentNotifierTestController::class ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -33,7 +33,7 @@ protected function setUp() $_SERVER['HTTP_HOST'] = 'www.mysite.com'; } - protected function tearDown() + protected function tearDown(): void { $_SERVER['HTTP_HOST'] = $this->oldhost; @@ -56,9 +56,9 @@ public function testSendEmail() $email = $this->findEmail('andrew@address.com', 'noreply@mysite.com', 'A new comment has been posted'); - $this->assertContains('
  • Bob Bobberson
  • ', $email['Content']); - $this->assertContains('
  • bob@address.com
  • ', $email['Content']); - $this->assertContains('
    Hey what a lovely comment
    ', $email['Content']); + $this->assertStringContainsString('
  • Bob Bobberson
  • ', $email['Content']); + $this->assertStringContainsString('
  • bob@address.com
  • ', $email['Content']); + $this->assertStringContainsString('
    Hey what a lovely comment
    ', $email['Content']); $this->clearEmails(); @@ -67,9 +67,12 @@ public function testSendEmail() $this->assertEmailSent('andrew@address.com', 'noreply@mysite.com', 'A new comment has been posted'); $email = $this->findEmail('andrew@address.com', 'noreply@mysite.com', 'A new comment has been posted'); - $this->assertContains('
  • Secret
  • ', $email['Content']); - $this->assertContains('
  • secret@notallowed.com
  • ', $email['Content']); - $this->assertContains('
    I don't want to disclose my details
    ', $email['Content']); + $this->assertStringContainsString('
  • Secret
  • ', $email['Content']); + $this->assertStringContainsString('
  • secret@notallowed.com
  • ', $email['Content']); + $this->assertStringContainsString( + '
    I don't want to disclose my details
    ', + $email['Content'] + ); $this->clearEmails(); @@ -79,9 +82,9 @@ public function testSendEmail() $email = $this->findEmail('andrew@address.com', 'noreply@mysite.com', 'A new comment has been posted'); - $this->assertContains('
  • Anonymous
  • ', $email['Content']); - $this->assertContains('
  • notlogged@in.com
  • ', $email['Content']); - $this->assertContains('
    I didn't log in
    ', $email['Content']); + $this->assertStringContainsString('
  • Anonymous
  • ', $email['Content']); + $this->assertStringContainsString('
  • notlogged@in.com
  • ', $email['Content']); + $this->assertStringContainsString('
    I didn't log in
    ', $email['Content']); $this->clearEmails();