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

API phpunit9 support #37

Merged
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
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
"issues": "https://github.com/silverstripe/silverstripe-akismet/issues"
},
"require": {
"php": "^7.3 || ^8.0",
"silverstripe/framework": "^4.10",
"silverstripe/cms": "^4.0",
"tijsverkoyen/akismet": "1.1.0",
"silverstripe/spamprotection": "^3.0"
},
"require-dev": {
"sminnee/phpunit": "^5.7",
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.0"
},
"autoload": {
Expand Down
8 changes: 5 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<phpunit bootstrap="vendor/silverstripe/cms/tests/bootstrap.php" colors="true">
<testsuite name="Default">
<directory>tests/</directory>
</testsuite>
<testsuites>
<testsuite name="Default">
<directory>tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src/</directory>
Expand Down
8 changes: 4 additions & 4 deletions tests/AkismetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AkismetTest extends FunctionalTest
AkismetTestController::class,
];

protected function setUp()
protected function setUp(): void
{
parent::setUp();
Injector::inst()->unregisterObjects(AkismetService::class);
Expand All @@ -55,7 +55,7 @@ public function testSpamDetectionForm()
'action_doSubmit' => 'Submit',
));

$this->assertContains('Thanks for your submission, person', $result->getBody());
$this->assertStringContainsString('Thanks for your submission, person', $result->getBody());
$saved = AkismetTestSubmission::get()->last();
$this->assertNotEmpty($saved);
$this->assertEquals('person', $saved->Name);
Expand All @@ -76,7 +76,7 @@ public function testSpamDetectionForm()
'SilverStripe\\Akismet\\AkismetField.SPAM',
"Your submission has been rejected because it was treated as spam."
);
$this->assertContains($errorMessage, $result->getBody());
$this->assertStringContainsString($errorMessage, $result->getBody());
$saved = AkismetTestSubmission::get()->last();
$this->assertEmpty($saved);
}
Expand All @@ -93,7 +93,7 @@ public function testSaveSpam()
'action_doSubmit' => 'Submit',
));

$this->assertContains('Thanks for your submission, person', $result->getBody());
$this->assertStringContainsString('Thanks for your submission, person', $result->getBody());
$saved = AkismetTestSubmission::get()->last();
$this->assertNotEmpty($saved);
$this->assertEquals('person', $saved->Name);
Expand Down