function ReplicatorTest::testReplicationBlocker in Workspace 8
File
- tests/
src/ Functional/ ReplicatorTest.php, line 420
Class
- ReplicatorTest
- Test the workspace entity.
Namespace
Drupal\Tests\workspace\FunctionalCode
function testReplicationBlocker() {
$test_user = $this
->drupalCreateUser([
'access administration pages',
]);
$this
->drupalLogin($test_user);
$this
->drupalGet('admin/config/replication/settings');
// Ensure Unblock replication button for
// Drupal\workspace\Form\UnblockReplicationForm is disabled.
$submit_is_disabled = $this
->cssSelect('form.unblock-replication-form input[type="submit"]:disabled');
$this
->assertTrue(count($submit_is_disabled) === 1, 'The Unblock replication button is disabled.');
$state = \Drupal::state();
$state
->set('workspace.last_replication_failed', TRUE);
$this
->drupalGet('admin/config/replication/settings');
// Now the Unblock replication button for
// Drupal\workspace\Form\UnblockReplicationForm should be enabled.
$submit_is_disabled = $this
->cssSelect('form.unblock-replication-form input[type="submit"]:disabled');
$this
->assertTrue(count($submit_is_disabled) === 0, 'The Unblock replication button is disabled.');
$this
->assertSession()
->buttonExists('Unblock replication');
$this
->drupalPostForm(NULL, [], 'Unblock replication');
$session = $this
->getSession();
$this
->assertEquals(200, $session
->getStatusCode());
$this
->assertFalse($state
->get('workspace.last_replication_failed'));
// Ensure Unblock replication button for
// Drupal\workspace\Form\UnblockReplicationForm is disabled again.
$submit_is_disabled = $this
->cssSelect('form.unblock-replication-form input[type="submit"]:disabled');
$this
->assertTrue(count($submit_is_disabled) === 1, 'The Unblock replication button is disabled.');
}