| @@ -7,12 +7,12 @@ | ||
| 7 | 7 | |
| 8 | 8 | class AkismetTestSubmission extends DataObject implements TestOnly | 
| 9 | 9 |  { | 
| 10 | - private static $db = array( | |
| 11 | - 'Name' => 'Varchar', | |
| 12 | - 'Email' => 'Varchar', | |
| 13 | - 'Content' => 'Text', | |
| 14 | - 'IsSpam' => 'Boolean', | |
| 15 | - ); | |
| 10 | + private static $db = array( | |
| 11 | + 'Name' => 'Varchar', | |
| 12 | + 'Email' => 'Varchar', | |
| 13 | + 'Content' => 'Text', | |
| 14 | + 'IsSpam' => 'Boolean', | |
| 15 | + ); | |
| 16 | 16 | |
| 17 | - private static $default_sort = 'ID'; | |
| 17 | + private static $default_sort = 'ID'; | |
| 18 | 18 | } | 
| @@ -7,8 +7,8 @@ | ||
| 7 | 7 | |
| 8 | 8 | class AkismetTestTestMiddleware extends AkismetMiddleware implements TestOnly | 
| 9 | 9 |  { | 
| 10 | - public function publicIsDBReady() | |
| 11 | -    { | |
| 12 | - return $this->isDBReady(); | |
| 13 | - } | |
| 10 | + public function publicIsDBReady() | |
| 11 | +	{ | |
| 12 | + return $this->isDBReady(); | |
| 13 | + } | |
| 14 | 14 | } | 
| @@ -19,47 +19,47 @@ | ||
| 19 | 19 | */ | 
| 20 | 20 | class AkismetTestController extends Controller implements TestOnly | 
| 21 | 21 |  { | 
| 22 | - private static $allowed_actions = array( | |
| 23 | - 'Form' | |
| 24 | - ); | |
| 22 | + private static $allowed_actions = array( | |
| 23 | + 'Form' | |
| 24 | + ); | |
| 25 | 25 | |
| 26 | - public function Form() | |
| 27 | -    { | |
| 28 | - $fields = new FieldList( | |
| 29 | -            new TextField('Name'), | |
| 30 | -            new EmailField('Email'), | |
| 31 | -            new TextareaField('Content') | |
| 32 | - ); | |
| 33 | -        $actions = new FieldList(new FormAction('doSubmit', 'Submit')); | |
| 34 | -        $validator = new RequiredFields('Name', 'Content'); | |
| 35 | - $form = new Form($this, 'Form', $fields, $actions, $validator); | |
| 26 | + public function Form() | |
| 27 | +	{ | |
| 28 | + $fields = new FieldList( | |
| 29 | +			new TextField('Name'), | |
| 30 | +			new EmailField('Email'), | |
| 31 | +			new TextareaField('Content') | |
| 32 | + ); | |
| 33 | +		$actions = new FieldList(new FormAction('doSubmit', 'Submit')); | |
| 34 | +		$validator = new RequiredFields('Name', 'Content'); | |
| 35 | + $form = new Form($this, 'Form', $fields, $actions, $validator); | |
| 36 | 36 | |
| 37 | - $form->enableSpamProtection(array( | |
| 38 | - 'protector' => AkismetSpamProtector::class, | |
| 39 | - 'name' => 'IsSpam', | |
| 40 | - 'mapping' => array( | |
| 41 | - 'Content' => 'body', | |
| 42 | - 'Name' => 'authorName', | |
| 43 | - 'Email' => 'authorMail', | |
| 44 | - ) | |
| 45 | - )); | |
| 37 | + $form->enableSpamProtection(array( | |
| 38 | + 'protector' => AkismetSpamProtector::class, | |
| 39 | + 'name' => 'IsSpam', | |
| 40 | + 'mapping' => array( | |
| 41 | + 'Content' => 'body', | |
| 42 | + 'Name' => 'authorName', | |
| 43 | + 'Email' => 'authorMail', | |
| 44 | + ) | |
| 45 | + )); | |
| 46 | 46 | |
| 47 | - // Because we don't want to be testing this | |
| 48 | - $form->disableSecurityToken(); | |
| 49 | - return $form; | |
| 50 | - } | |
| 47 | + // Because we don't want to be testing this | |
| 48 | + $form->disableSecurityToken(); | |
| 49 | + return $form; | |
| 50 | + } | |
| 51 | 51 | |
| 52 | - public function doSubmit($data, Form $form) | |
| 53 | -    { | |
| 54 | - $item = new AkismetTestSubmission(); | |
| 55 | - $form->saveInto($item); | |
| 56 | - $item->write(); | |
| 57 | -        $form->sessionMessage('Thanks for your submission, ' . $data['Name'], 'good'); | |
| 58 | - return $this->redirect($this->Link()); | |
| 59 | - } | |
| 52 | + public function doSubmit($data, Form $form) | |
| 53 | +	{ | |
| 54 | + $item = new AkismetTestSubmission(); | |
| 55 | + $form->saveInto($item); | |
| 56 | + $item->write(); | |
| 57 | +		$form->sessionMessage('Thanks for your submission, ' . $data['Name'], 'good'); | |
| 58 | + return $this->redirect($this->Link()); | |
| 59 | + } | |
| 60 | 60 | |
| 61 | - public function Link($action = null) | |
| 62 | -    { | |
| 63 | - return 'AkismetTestController'; | |
| 64 | - } | |
| 61 | + public function Link($action = null) | |
| 62 | +	{ | |
| 63 | + return 'AkismetTestController'; | |
| 64 | + } | |
| 65 | 65 | } | 
| @@ -54,7 +54,7 @@ | ||
| 54 | 54 | $item = new AkismetTestSubmission(); | 
| 55 | 55 | $form->saveInto($item); | 
| 56 | 56 | $item->write(); | 
| 57 | -        $form->sessionMessage('Thanks for your submission, ' . $data['Name'], 'good'); | |
| 57 | +        $form->sessionMessage('Thanks for your submission, '.$data['Name'], 'good'); | |
| 58 | 58 | return $this->redirect($this->Link()); | 
| 59 | 59 | } | 
| 60 | 60 | |
| @@ -8,16 +8,16 @@ | ||
| 8 | 8 | |
| 9 | 9 | class AkismetTestService implements TestOnly, AkismetService | 
| 10 | 10 |  { | 
| 11 | - public function __construct($apiKey, $url) | |
| 12 | -    { | |
| 13 | -        if ($apiKey !== 'dummykey') { | |
| 14 | -            throw new Exception("Invalid key"); | |
| 15 | - } | |
| 16 | - } | |
| 11 | + public function __construct($apiKey, $url) | |
| 12 | +	{ | |
| 13 | +		if ($apiKey !== 'dummykey') { | |
| 14 | +			throw new Exception("Invalid key"); | |
| 15 | + } | |
| 16 | + } | |
| 17 | 17 | |
| 18 | - public function isSpam($content, $author = null, $email = null, $url = null, $permalink = null, $type = null) | |
| 19 | -    { | |
| 20 | - // This dummy service only checks the content | |
| 21 | - return $content === 'spam'; | |
| 22 | - } | |
| 18 | + public function isSpam($content, $author = null, $email = null, $url = null, $permalink = null, $type = null) | |
| 19 | +	{ | |
| 20 | + // This dummy service only checks the content | |
| 21 | + return $content === 'spam'; | |
| 22 | + } | |
| 23 | 23 | } | 
| @@ -9,26 +9,26 @@ | ||
| 9 | 9 | |
| 10 | 10 | class AkismetSpamProtectorTest extends SapphireTest | 
| 11 | 11 |  { | 
| 12 | - public function testGetApiKeyPriority() | |
| 13 | -    { | |
| 14 | - $spamProtector = AkismetSpamProtector::singleton(); | |
| 12 | + public function testGetApiKeyPriority() | |
| 13 | +	{ | |
| 14 | + $spamProtector = AkismetSpamProtector::singleton(); | |
| 15 | 15 | |
| 16 | - // Clear all possible values from the environment | |
| 17 | - Config::modify()->set(AkismetSpamProtector::class, 'api_key', ''); | |
| 18 | -        Environment::setEnv('SS_AKISMET_API_KEY', ''); | |
| 19 | -        $this->assertSame('', $spamProtector->getApiKey(), 'Blank string returned by default'); | |
| 16 | + // Clear all possible values from the environment | |
| 17 | + Config::modify()->set(AkismetSpamProtector::class, 'api_key', ''); | |
| 18 | +		Environment::setEnv('SS_AKISMET_API_KEY', ''); | |
| 19 | +		$this->assertSame('', $spamProtector->getApiKey(), 'Blank string returned by default'); | |
| 20 | 20 | |
| 21 | - // Set some values in all possible places | |
| 22 | -        $spamProtector->setApiKey('instance_api_key'); | |
| 23 | - Config::modify()->set(AkismetSpamProtector::class, 'api_key', 'config_api_key'); | |
| 24 | -        Environment::setEnv('SS_AKISMET_API_KEY', 'env_api_key'); | |
| 21 | + // Set some values in all possible places | |
| 22 | +		$spamProtector->setApiKey('instance_api_key'); | |
| 23 | + Config::modify()->set(AkismetSpamProtector::class, 'api_key', 'config_api_key'); | |
| 24 | +		Environment::setEnv('SS_AKISMET_API_KEY', 'env_api_key'); | |
| 25 | 25 | |
| 26 | -        $this->assertSame('instance_api_key', $spamProtector->getApiKey(), 'Instance value is given priority'); | |
| 26 | +		$this->assertSame('instance_api_key', $spamProtector->getApiKey(), 'Instance value is given priority'); | |
| 27 | 27 | |
| 28 | -        $spamProtector->setApiKey(''); | |
| 29 | -        $this->assertSame('config_api_key', $spamProtector->getApiKey(), 'Config value is second priority'); | |
| 28 | +		$spamProtector->setApiKey(''); | |
| 29 | +		$this->assertSame('config_api_key', $spamProtector->getApiKey(), 'Config value is second priority'); | |
| 30 | 30 | |
| 31 | - Config::modify()->set(AkismetSpamProtector::class, 'api_key', ''); | |
| 32 | -        $this->assertSame('env_api_key', $spamProtector->getApiKey(), 'Environment value is last priority'); | |
| 33 | - } | |
| 31 | + Config::modify()->set(AkismetSpamProtector::class, 'api_key', ''); | |
| 32 | +		$this->assertSame('env_api_key', $spamProtector->getApiKey(), 'Environment value is last priority'); | |
| 33 | + } | |
| 34 | 34 | } | 
| @@ -15,135 +15,135 @@ | ||
| 15 | 15 | |
| 16 | 16 | class AkismetTest extends FunctionalTest | 
| 17 | 17 |  { | 
| 18 | - protected static $extra_dataobjects = [AkismetTestSubmission::class]; | |
| 19 | - | |
| 20 | - protected $usesDatabase = true; | |
| 21 | - | |
| 22 | - protected static $required_extensions = [ | |
| 23 | - SiteConfig::class => [ | |
| 24 | - AkismetConfig::class, | |
| 25 | - ], | |
| 26 | - ]; | |
| 27 | - | |
| 28 | - protected static $extra_controllers = [ | |
| 29 | - AkismetTestController::class, | |
| 30 | - ]; | |
| 31 | - | |
| 32 | - protected function setUp() | |
| 33 | -    { | |
| 34 | - parent::setUp(); | |
| 35 | - Injector::inst()->unregisterObjects(AkismetService::class); | |
| 36 | - | |
| 37 | - // Mock service | |
| 38 | - Config::modify()->set(Injector::class, AkismetService::class, AkismetTestService::class); | |
| 39 | - Config::modify()->set(AkismetSpamProtector::class, 'api_key', 'dummykey'); | |
| 40 | - | |
| 41 | - // Reset options to reasonable default | |
| 42 | - Config::modify()->remove(AkismetSpamProtector::class, 'save_spam'); | |
| 43 | - Config::modify()->remove(AkismetSpamProtector::class, 'require_confirmation'); | |
| 44 | - Config::modify()->remove(AkismetSpamProtector::class, 'bypass_members'); | |
| 45 | - Config::modify()->set(AkismetSpamProtector::class, 'bypass_permission', 'ADMIN'); | |
| 46 | - } | |
| 47 | - | |
| 48 | - public function testSpamDetectionForm() | |
| 49 | -    { | |
| 50 | - // Test "nice" setting | |
| 51 | -        $result = $this->post('AkismetTestController/Form', array( | |
| 52 | - 'Name' => 'person', | |
| 53 | - 'Email' => '[email protected]', | |
| 54 | - 'Content' => 'what a nice comment', | |
| 55 | - 'action_doSubmit' => 'Submit', | |
| 56 | - )); | |
| 57 | - | |
| 58 | -        $this->assertContains('Thanks for your submission, person', $result->getBody()); | |
| 59 | - $saved = AkismetTestSubmission::get()->last(); | |
| 60 | - $this->assertNotEmpty($saved); | |
| 61 | -        $this->assertEquals('person', $saved->Name); | |
| 62 | -        $this->assertEquals('[email protected]', $saved->Email); | |
| 63 | -        $this->assertEquals('what a nice comment', $saved->Content); | |
| 64 | - $this->assertEquals(false, (bool)$saved->IsSpam); | |
| 65 | - $saved->delete(); | |
| 66 | - | |
| 67 | - // Test failed setting | |
| 68 | -        $result = $this->post('AkismetTestController/Form', array( | |
| 69 | - 'Name' => 'spam', | |
| 70 | - 'Email' => '[email protected]', | |
| 71 | - 'Content' => 'spam', | |
| 72 | - 'action_doSubmit' => 'Submit', | |
| 73 | - )); | |
| 74 | - | |
| 75 | - $errorMessage = _t( | |
| 76 | - 'SilverStripe\\Akismet\\AkismetField.SPAM', | |
| 77 | - "Your submission has been rejected because it was treated as spam." | |
| 78 | - ); | |
| 79 | - $this->assertContains($errorMessage, $result->getBody()); | |
| 80 | - $saved = AkismetTestSubmission::get()->last(); | |
| 81 | - $this->assertEmpty($saved); | |
| 82 | - } | |
| 83 | - | |
| 84 | - public function testSaveSpam() | |
| 85 | -    { | |
| 86 | - Config::modify()->set(AkismetSpamProtector::class, 'save_spam', true); | |
| 87 | - | |
| 88 | - // Test "nice" setting | |
| 89 | -        $result = $this->post('AkismetTestController/Form', array( | |
| 90 | - 'Name' => 'person', | |
| 91 | - 'Email' => '[email protected]', | |
| 92 | - 'Content' => 'what a nice comment', | |
| 93 | - 'action_doSubmit' => 'Submit', | |
| 94 | - )); | |
| 95 | - | |
| 96 | -        $this->assertContains('Thanks for your submission, person', $result->getBody()); | |
| 97 | - $saved = AkismetTestSubmission::get()->last(); | |
| 98 | - $this->assertNotEmpty($saved); | |
| 99 | -        $this->assertEquals('person', $saved->Name); | |
| 100 | -        $this->assertEquals('[email protected]', $saved->Email); | |
| 101 | -        $this->assertEquals('what a nice comment', $saved->Content); | |
| 102 | - $this->assertEquals(false, (bool)$saved->IsSpam); | |
| 103 | - $saved->delete(); | |
| 104 | - | |
| 105 | -        $this->markTestIncomplete('@todo fix form validation message in AkismetField'); | |
| 106 | - | |
| 107 | - // Test failed setting | |
| 108 | -        $result = $this->post('AkismetTestController/Form', array( | |
| 109 | - 'Name' => 'spam', | |
| 110 | - 'Email' => '[email protected]', | |
| 111 | - 'Content' => 'spam', | |
| 112 | - 'action_doSubmit' => 'Submit', | |
| 113 | - )); | |
| 114 | - | |
| 115 | - $errorMessage = _t( | |
| 116 | - 'SilverStripe\\Akismet\\AkismetField.SPAM', | |
| 117 | - "Your submission has been rejected because it was treated as spam." | |
| 118 | - ); | |
| 119 | - $this->assertContains($errorMessage, $result->getBody()); | |
| 120 | - $saved = AkismetTestSubmission::get()->last(); | |
| 121 | - $this->assertNotEmpty($saved); | |
| 122 | -        $this->assertEquals('spam', $saved->Name); | |
| 123 | -        $this->assertEquals('[email protected]', $saved->Email); | |
| 124 | -        $this->assertEquals('spam', $saved->Content); | |
| 125 | - $this->assertEquals(true, (bool)$saved->IsSpam); | |
| 126 | - } | |
| 127 | - | |
| 128 | - /** | |
| 129 | - * Test that the request processor can safely activate when able (and only then) | |
| 130 | - */ | |
| 131 | - public function testProcessor() | |
| 132 | -    { | |
| 133 | - $siteconfig = SiteConfig::current_site_config(); | |
| 134 | - $siteconfig->write(); | |
| 135 | - | |
| 136 | - // Test assignment via request filter | |
| 137 | - $processor = new AkismetTestTestMiddleware(); | |
| 138 | - $this->assertTrue($processor->publicIsDBReady()); | |
| 139 | - | |
| 140 | -        try { | |
| 141 | - // Remove AkismetKey field | |
| 142 | - $siteconfigTable = DataObject::getSchema()->tableName(SiteConfig::class); | |
| 143 | -            DB::query('ALTER TABLE "' . $siteconfigTable . '" DROP COLUMN "AkismetKey"'); | |
| 144 | -        } catch (DatabaseException $e) { | |
| 145 | -            $this->markTestSkipped('Could not DROP database column'); | |
| 146 | - } | |
| 147 | - $this->assertFalse($processor->publicIsDBReady()); | |
| 148 | - } | |
| 18 | + protected static $extra_dataobjects = [AkismetTestSubmission::class]; | |
| 19 | + | |
| 20 | + protected $usesDatabase = true; | |
| 21 | + | |
| 22 | + protected static $required_extensions = [ | |
| 23 | + SiteConfig::class => [ | |
| 24 | + AkismetConfig::class, | |
| 25 | + ], | |
| 26 | + ]; | |
| 27 | + | |
| 28 | + protected static $extra_controllers = [ | |
| 29 | + AkismetTestController::class, | |
| 30 | + ]; | |
| 31 | + | |
| 32 | + protected function setUp() | |
| 33 | +	{ | |
| 34 | + parent::setUp(); | |
| 35 | + Injector::inst()->unregisterObjects(AkismetService::class); | |
| 36 | + | |
| 37 | + // Mock service | |
| 38 | + Config::modify()->set(Injector::class, AkismetService::class, AkismetTestService::class); | |
| 39 | + Config::modify()->set(AkismetSpamProtector::class, 'api_key', 'dummykey'); | |
| 40 | + | |
| 41 | + // Reset options to reasonable default | |
| 42 | + Config::modify()->remove(AkismetSpamProtector::class, 'save_spam'); | |
| 43 | + Config::modify()->remove(AkismetSpamProtector::class, 'require_confirmation'); | |
| 44 | + Config::modify()->remove(AkismetSpamProtector::class, 'bypass_members'); | |
| 45 | + Config::modify()->set(AkismetSpamProtector::class, 'bypass_permission', 'ADMIN'); | |
| 46 | + } | |
| 47 | + | |
| 48 | + public function testSpamDetectionForm() | |
| 49 | +	{ | |
| 50 | + // Test "nice" setting | |
| 51 | +		$result = $this->post('AkismetTestController/Form', array( | |
| 52 | + 'Name' => 'person', | |
| 53 | + 'Email' => '[email protected]', | |
| 54 | + 'Content' => 'what a nice comment', | |
| 55 | + 'action_doSubmit' => 'Submit', | |
| 56 | + )); | |
| 57 | + | |
| 58 | +		$this->assertContains('Thanks for your submission, person', $result->getBody()); | |
| 59 | + $saved = AkismetTestSubmission::get()->last(); | |
| 60 | + $this->assertNotEmpty($saved); | |
| 61 | +		$this->assertEquals('person', $saved->Name); | |
| 62 | +		$this->assertEquals('[email protected]', $saved->Email); | |
| 63 | +		$this->assertEquals('what a nice comment', $saved->Content); | |
| 64 | + $this->assertEquals(false, (bool)$saved->IsSpam); | |
| 65 | + $saved->delete(); | |
| 66 | + | |
| 67 | + // Test failed setting | |
| 68 | +		$result = $this->post('AkismetTestController/Form', array( | |
| 69 | + 'Name' => 'spam', | |
| 70 | + 'Email' => '[email protected]', | |
| 71 | + 'Content' => 'spam', | |
| 72 | + 'action_doSubmit' => 'Submit', | |
| 73 | + )); | |
| 74 | + | |
| 75 | + $errorMessage = _t( | |
| 76 | + 'SilverStripe\\Akismet\\AkismetField.SPAM', | |
| 77 | + "Your submission has been rejected because it was treated as spam." | |
| 78 | + ); | |
| 79 | + $this->assertContains($errorMessage, $result->getBody()); | |
| 80 | + $saved = AkismetTestSubmission::get()->last(); | |
| 81 | + $this->assertEmpty($saved); | |
| 82 | + } | |
| 83 | + | |
| 84 | + public function testSaveSpam() | |
| 85 | +	{ | |
| 86 | + Config::modify()->set(AkismetSpamProtector::class, 'save_spam', true); | |
| 87 | + | |
| 88 | + // Test "nice" setting | |
| 89 | +		$result = $this->post('AkismetTestController/Form', array( | |
| 90 | + 'Name' => 'person', | |
| 91 | + 'Email' => '[email protected]', | |
| 92 | + 'Content' => 'what a nice comment', | |
| 93 | + 'action_doSubmit' => 'Submit', | |
| 94 | + )); | |
| 95 | + | |
| 96 | +		$this->assertContains('Thanks for your submission, person', $result->getBody()); | |
| 97 | + $saved = AkismetTestSubmission::get()->last(); | |
| 98 | + $this->assertNotEmpty($saved); | |
| 99 | +		$this->assertEquals('person', $saved->Name); | |
| 100 | +		$this->assertEquals('[email protected]', $saved->Email); | |
| 101 | +		$this->assertEquals('what a nice comment', $saved->Content); | |
| 102 | + $this->assertEquals(false, (bool)$saved->IsSpam); | |
| 103 | + $saved->delete(); | |
| 104 | + | |
| 105 | +		$this->markTestIncomplete('@todo fix form validation message in AkismetField'); | |
| 106 | + | |
| 107 | + // Test failed setting | |
| 108 | +		$result = $this->post('AkismetTestController/Form', array( | |
| 109 | + 'Name' => 'spam', | |
| 110 | + 'Email' => '[email protected]', | |
| 111 | + 'Content' => 'spam', | |
| 112 | + 'action_doSubmit' => 'Submit', | |
| 113 | + )); | |
| 114 | + | |
| 115 | + $errorMessage = _t( | |
| 116 | + 'SilverStripe\\Akismet\\AkismetField.SPAM', | |
| 117 | + "Your submission has been rejected because it was treated as spam." | |
| 118 | + ); | |
| 119 | + $this->assertContains($errorMessage, $result->getBody()); | |
| 120 | + $saved = AkismetTestSubmission::get()->last(); | |
| 121 | + $this->assertNotEmpty($saved); | |
| 122 | +		$this->assertEquals('spam', $saved->Name); | |
| 123 | +		$this->assertEquals('[email protected]', $saved->Email); | |
| 124 | +		$this->assertEquals('spam', $saved->Content); | |
| 125 | + $this->assertEquals(true, (bool)$saved->IsSpam); | |
| 126 | + } | |
| 127 | + | |
| 128 | + /** | |
| 129 | + * Test that the request processor can safely activate when able (and only then) | |
| 130 | + */ | |
| 131 | + public function testProcessor() | |
| 132 | +	{ | |
| 133 | + $siteconfig = SiteConfig::current_site_config(); | |
| 134 | + $siteconfig->write(); | |
| 135 | + | |
| 136 | + // Test assignment via request filter | |
| 137 | + $processor = new AkismetTestTestMiddleware(); | |
| 138 | + $this->assertTrue($processor->publicIsDBReady()); | |
| 139 | + | |
| 140 | +		try { | |
| 141 | + // Remove AkismetKey field | |
| 142 | + $siteconfigTable = DataObject::getSchema()->tableName(SiteConfig::class); | |
| 143 | +			DB::query('ALTER TABLE "' . $siteconfigTable . '" DROP COLUMN "AkismetKey"'); | |
| 144 | +		} catch (DatabaseException $e) { | |
| 145 | +			$this->markTestSkipped('Could not DROP database column'); | |
| 146 | + } | |
| 147 | + $this->assertFalse($processor->publicIsDBReady()); | |
| 148 | + } | |
| 149 | 149 | } | 
| @@ -61,7 +61,7 @@ discard block | ||
| 61 | 61 |          $this->assertEquals('person', $saved->Name); | 
| 62 | 62 |          $this->assertEquals('[email protected]', $saved->Email); | 
| 63 | 63 |          $this->assertEquals('what a nice comment', $saved->Content); | 
| 64 | - $this->assertEquals(false, (bool)$saved->IsSpam); | |
| 64 | + $this->assertEquals(false, (bool) $saved->IsSpam); | |
| 65 | 65 | $saved->delete(); | 
| 66 | 66 | |
| 67 | 67 | // Test failed setting | 
| @@ -99,7 +99,7 @@ discard block | ||
| 99 | 99 |          $this->assertEquals('person', $saved->Name); | 
| 100 | 100 |          $this->assertEquals('[email protected]', $saved->Email); | 
| 101 | 101 |          $this->assertEquals('what a nice comment', $saved->Content); | 
| 102 | - $this->assertEquals(false, (bool)$saved->IsSpam); | |
| 102 | + $this->assertEquals(false, (bool) $saved->IsSpam); | |
| 103 | 103 | $saved->delete(); | 
| 104 | 104 | |
| 105 | 105 |          $this->markTestIncomplete('@todo fix form validation message in AkismetField'); | 
| @@ -122,7 +122,7 @@ discard block | ||
| 122 | 122 |          $this->assertEquals('spam', $saved->Name); | 
| 123 | 123 |          $this->assertEquals('[email protected]', $saved->Email); | 
| 124 | 124 |          $this->assertEquals('spam', $saved->Content); | 
| 125 | - $this->assertEquals(true, (bool)$saved->IsSpam); | |
| 125 | + $this->assertEquals(true, (bool) $saved->IsSpam); | |
| 126 | 126 | } | 
| 127 | 127 | |
| 128 | 128 | /** | 
| @@ -140,7 +140,7 @@ discard block | ||
| 140 | 140 |          try { | 
| 141 | 141 | // Remove AkismetKey field | 
| 142 | 142 | $siteconfigTable = DataObject::getSchema()->tableName(SiteConfig::class); | 
| 143 | -            DB::query('ALTER TABLE "' . $siteconfigTable . '" DROP COLUMN "AkismetKey"'); | |
| 143 | +            DB::query('ALTER TABLE "'.$siteconfigTable.'" DROP COLUMN "AkismetKey"'); | |
| 144 | 144 |          } catch (DatabaseException $e) { | 
| 145 | 145 |              $this->markTestSkipped('Could not DROP database column'); | 
| 146 | 146 | } |