You are here

protected function OverrideNodeOptionsTest::testNodeRevisions in Override Node Options 7

Test the 'Revision information' fieldset.

File

src/Tests/Functional/OverrideNodeOptionsTest.php, line 156
Unit tests for the override_node_options module.

Class

OverrideNodeOptionsTest
Defines a base class for testing the Override Node Options module.

Namespace

Drupal\override_node_options\Tests\Functional

Code

protected function testNodeRevisions() {
  $specific_user = $this
    ->drupalCreateUser(array(
    'create page content',
    'edit any page content',
    'override page revision option',
  ));
  $general_user = $this
    ->drupalCreateUser(array(
    'create page content',
    'edit any page content',
    'override all revision option',
  ));
  foreach (array(
    $specific_user,
    $general_user,
  ) as $account) {
    $this
      ->drupalLogin($account);

    // Ensure that we have the latest node data.
    $node = node_load($this->node->nid, NULL, TRUE);
    $fields = array(
      'revision' => TRUE,
    );
    $this
      ->drupalPost("node/{$node->nid}/edit", $fields, t('Save'));
    $this
      ->assertNodeFieldsUpdated($node, array(
      'vid' => $node->vid + 1,
    ));
  }
  $this
    ->drupalLogin($this->normalUser);
  $this
    ->assertNodeFieldsNoAccess($this->node, array_keys($fields));
}