ReplicationSettingsPageTest.php in Replication 8
File
tests/src/Functional/ReplicationSettingsPageTest.php
View source
<?php
namespace Drupal\Tests\replication\Functional;
use Drupal\Tests\BrowserTestBase;
class ReplicationSettingsPageTest extends BrowserTestBase {
public static $modules = [
'multiversion',
'user',
'replication',
];
protected $user;
protected function setUp() {
parent::setUp();
$this->user = $this
->drupalCreateUser([
'access administration pages',
]);
}
public function testReplicationConfigurationForms() {
$this
->drupalLogin($this->user);
$this
->drupalGet('admin/config/replication/settings');
$this
->assertText('Replication settings');
$this
->assertText('Replication configuration');
$this
->assertFieldByName('mapping_type', 'uid_1');
$this
->assertFieldByName('uid', '');
$this
->assertFieldByName('changes_limit', 100);
$this
->assertFieldByName('bulk_docs_limit', 100);
$this
->assertFieldByName('replication_execution_limit', 1);
$this
->assertFieldByName('verbose_logging', FALSE);
$edit = [
'mapping_type' => 'uid',
'uid' => $this->user
->id(),
'changes_limit' => 200,
'bulk_docs_limit' => 200,
'replication_execution_limit' => 4,
'verbose_logging' => TRUE,
];
$this
->drupalPostForm(NULL, $edit, 'Save configuration');
$this
->assertText('The configuration options have been saved.');
$this
->assertText('Replication settings');
$this
->assertText('Replication configuration');
$this
->assertFieldByName('mapping_type', 'uid');
$this
->assertFieldByName('uid', $this->user
->id());
$this
->assertFieldByName('changes_limit', 200);
$this
->assertFieldByName('bulk_docs_limit', 200);
$this
->assertFieldByName('replication_execution_limit', 4);
$this
->assertFieldByName('verbose_logging', TRUE);
}
}