DomainContentActionsTest.php in Domain Access 8
File
domain_content/tests/src/Functional/DomainContentActionsTest.php
View source
<?php
namespace Drupal\Tests\domain_content\Functional;
class DomainContentActionsTest extends DomainContentTestBase {
public function testDomainContentActions() {
$this->admin_user = $this
->drupalCreateUser([
'administer domains',
'access administration pages',
'access domain content',
'access domain content editors',
'publish to any domain',
'assign editors to any domain',
'bypass node access',
]);
$this
->drupalLogin($this->admin_user);
$this
->createDomainContent();
$url = 'admin/content/domain-content/all_affiliates';
$this
->drupalGet($url);
$old_domain = $this->domains['one_example_com'];
$new_domain = $this->domains['two_example_com'];
$this
->assertRaw($old_domain
->label() . '</a>');
$this
->assertNoRaw($new_domain
->label() . '</a>');
$edit = [
'node_bulk_form[0]' => TRUE,
'node_bulk_form[1]' => TRUE,
'action' => 'domain_access_add_action.two_example_com',
];
$this
->submitForm($edit, 'Apply to selected items');
$this
->assertRaw($old_domain
->label() . '</a>');
$this
->assertRaw($new_domain
->label() . '</a>');
$edit = [
'node_bulk_form[0]' => TRUE,
'node_bulk_form[1]' => TRUE,
'action' => 'domain_access_remove_action.two_example_com',
];
$this
->submitForm($edit, 'Apply to selected items');
$this
->assertRaw($old_domain
->label() . '</a>');
$this
->assertNoRaw($new_domain
->label() . '</a>');
$this
->assertRaw('node_bulk_form[4]');
$edit = [
'node_bulk_form[0]' => TRUE,
'action' => 'domain_access_none_action',
];
$this
->submitForm($edit, 'Apply to selected items');
$this
->assertRaw('node_bulk_form[3]');
$this
->assertNoRaw('node_bulk_form[4]');
}
}