public function RngEventAccessWebTest::testEventAccessCustomized in RNG - Events and Registrations 8.2
Same name and namespace in other branches
- 8 tests/src/Functional/RngEventAccessWebTest.php \Drupal\Tests\rng\Functional\RngEventAccessWebTest::testEventAccessCustomized()
- 3.x tests/src/Functional/RngEventAccessWebTest.php \Drupal\Tests\rng\Functional\RngEventAccessWebTest::testEventAccessCustomized()
Test event access page when using custom rules.
File
- tests/
src/ Functional/ RngEventAccessWebTest.php, line 76
Class
- RngEventAccessWebTest
- Tests manage event access page.
Namespace
Drupal\Tests\rng\FunctionalCode
public function testEventAccessCustomized() {
$user1 = $this
->drupalCreateUser([
'view test entity',
'administer entity_test content',
]);
$this
->drupalLogin($user1);
$event_meta = $this
->createEvent([
'user_id' => $user1
->id(),
]);
$event_meta
->addDefaultAccess();
$this
->drupalGet(Url::fromRoute('rng.event.entity_test.access', [
'entity_test' => $event_meta
->getEvent()
->id(),
]));
// Reset access rules button.
$reset_link = Url::fromRoute('rng.event.entity_test.access.reset', [
'entity_test' => $event_meta
->getEvent()
->id(),
]);
$this
->assertSession()
->linkExists(t('Reset access rules to site default'));
$this
->assertSession()
->linkByHrefExists($reset_link
->toString());
// Check if one of the checkboxes is enabled.
$field_name = 'table[6][operation_create][enabled]';
$this
->assertSession()
->fieldExists($field_name);
$input = $this
->xpath('//input[@name="' . $field_name . '" and @disabled="disabled"]');
$this
->assertTrue(count($input) === 0, 'The create checkbox is not disabled.');
}