mirror of
https://github.com/silverstripe/silverstripe-comments
synced 2024-10-22 11:05:49 +02:00
FIX Mock akismet spam protector if installed, fixes broken integration tests
This commit is contained in:
parent
eca3ac0e94
commit
788cb6e6d1
@ -2,14 +2,15 @@
|
|||||||
|
|
||||||
namespace SilverStripe\Comments\Tests;
|
namespace SilverStripe\Comments\Tests;
|
||||||
|
|
||||||
|
use SilverStripe\Akismet\AkismetSpamProtector;
|
||||||
use SilverStripe\Comments\Controllers\CommentingController;
|
use SilverStripe\Comments\Controllers\CommentingController;
|
||||||
use SilverStripe\Comments\Model\Comment;
|
use SilverStripe\Comments\Model\Comment;
|
||||||
use SilverStripe\Comments\Model\Comment\SecurityToken as CommentSecurityToken;
|
use SilverStripe\Comments\Model\Comment\SecurityToken as CommentSecurityToken;
|
||||||
use SilverStripe\Comments\Tests\Stubs\CommentableItem;
|
use SilverStripe\Comments\Tests\Stubs\CommentableItem;
|
||||||
use SilverStripe\Comments\Tests\CommentTestHelper;
|
|
||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\Core\Email\Email;
|
use SilverStripe\Core\Email\Email;
|
||||||
|
use SilverStripe\Core\Injector\Injector;
|
||||||
use SilverStripe\Dev\FunctionalTest;
|
use SilverStripe\Dev\FunctionalTest;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\Security\Member;
|
use SilverStripe\Security\Member;
|
||||||
@ -48,6 +49,12 @@ class CommentingControllerTest extends FunctionalTest
|
|||||||
|
|
||||||
// We will assert against explicit responses, unless handed otherwise in a test for redirects
|
// We will assert against explicit responses, unless handed otherwise in a test for redirects
|
||||||
$this->autoFollowRedirection = false;
|
$this->autoFollowRedirection = false;
|
||||||
|
|
||||||
|
// Mock Akismet if it's installed
|
||||||
|
if (class_exists(AkismetSpamProtector::class)) {
|
||||||
|
$akismetMock = $this->createMock(AkismetSpamProtector::class);
|
||||||
|
Injector::inst()->registerService($akismetMock, AkismetSpamProtector::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCommentsFormUsePreview()
|
public function testCommentsFormUsePreview()
|
||||||
|
Loading…
Reference in New Issue
Block a user