AkamaiConfigFormTest.php in Akamai 8.3
File
src/Tests/AkamaiConfigFormTest.php
View source
<?php
namespace Drupal\akamai\Tests;
use Drupal\Tests\BrowserTestBase;
use Drupal\Core\Url;
class AkamaiConfigFormTest extends BrowserTestBase {
protected $privilegedUser;
public static $modules = [
'system_test',
'node',
'user',
'akamai',
];
protected function setUp() {
parent::setUp();
$this->privilegedUser = $this
->drupalCreateUser([
'purge akamai cache',
'administer akamai',
'purge akamai cache',
]);
$this
->drupalLogin($this->privilegedUser);
}
public function testConfigForm() {
$edit['basepath'] = 'http://www.example.com';
$edit['timeout'] = 20;
$edit['domain'] = 'staging';
$edit['ccu_version'] = 'v3';
$edit['v3[action]'] = 'invalidate';
$this
->drupalPostForm('admin/config/akamai/config', $edit, t('Save configuration'));
$edit['timeout'] = 'lol';
$this
->drupalPostForm(Url::fromRoute('akamai.settings')
->getInternalPath(), $edit, t('Save configuration'));
$this
->assertText(t('Please enter only integer values in this field.'), 'Allowed only integer timeout values');
}
}