public function NodeFormTest::testNodeOptions in Override Node Options 8.3
Same name and namespace in other branches
- 8.2 tests/src/Functional/NodeFormTest.php \Drupal\Tests\override_node_options\Functional\NodeFormTest::testNodeOptions()
Test the 'Authoring information' fieldset.
File
- tests/
src/ Functional/ NodeFormTest.php, line 119
Class
- NodeFormTest
- Unit tests for the override_node_options module.
Namespace
Drupal\Tests\override_node_options\FunctionalCode
public function testNodeOptions() {
$specific_user = $this
->drupalCreateUser([
'create page content',
'edit any page content',
'override page published option',
'override page promote to front page option',
'override page sticky option',
]);
$general_user = $this
->drupalCreateUser([
'create page content',
'edit any page content',
'override all published option',
'override all promote to front page option',
'override all sticky option',
]);
$fields = [
'promote' => TRUE,
'status' => TRUE,
'sticky' => TRUE,
];
foreach ([
$specific_user,
$general_user,
] as $user) {
$this
->drupalLogin($user);
$this
->drupalPostForm("node/{$this->node->id()}/edit", [
'promote[value]' => TRUE,
'status[value]' => TRUE,
'sticky[value]' => TRUE,
], t('Save'));
$this
->assertNodeFieldsUpdated($this->node, $fields);
}
$this
->drupalLogin($this->normalUser);
$this
->assertNodeFieldsNoAccess($this->node, array_keys($fields));
}