NEW Add NullSpamProtector

This commit is contained in:
Steve Boyd 2023-01-18 14:54:46 +13:00
parent 83570153e8
commit 5afed61c5f
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
name: frameworktest-spamprotection
---
SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension:
default_spam_protector: SilverStripe\FrameworkTest\NullSpamProtector\NullSpamProtector

View File

@ -0,0 +1,28 @@
<?php
namespace SilverStripe\FrameworkTest\NullSpamProtector;
use SilverStripe\Forms\HiddenField;
use SilverStripe\SpamProtection\SpamProtector;
if (!interface_exists(SpamProtector::class)) {
return;
}
/**
* This is a minimum implementation used in CI for silverstripe/spamprotector so there's a default_spam_protector
*
* This used to be done by silverstripe/akismet, but that's no longer being used in CMS 5
*/
class NullSpamProtector implements SpamProtector
{
public function getFormField($name = null, $title = null, $value = null)
{
return new HiddenField('NullSpamProtector');
}
public function setFieldMapping($fieldMapping)
{
// no-op
}
}