Chris@0: editor = $this->drupalCreateUser([ Chris@0: 'administer nodes', Chris@0: 'edit any page content', Chris@0: 'view page revisions', Chris@0: 'bypass node access', Chris@0: 'access user profiles', Chris@0: ]); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Checks that the Revision tab is displayed correctly. Chris@0: */ Chris@0: public function testDisplayRevisionTab() { Chris@0: $this->drupalPlaceBlock('local_tasks_block'); Chris@0: Chris@0: $this->drupalLogin($this->editor); Chris@0: $node_storage = $this->container->get('entity.manager')->getStorage('node'); Chris@0: Chris@0: // Set page revision setting 'create new revision'. This will mean new Chris@0: // revisions are created by default when the node is edited. Chris@0: $type = NodeType::load('page'); Chris@0: $type->setNewRevision(TRUE); Chris@0: $type->save(); Chris@0: Chris@0: // Create the node. Chris@0: $node = $this->drupalCreateNode(); Chris@0: Chris@0: // Verify the checkbox is checked on the node edit form. Chris@0: $this->drupalGet('node/' . $node->id() . '/edit'); Chris@0: $this->assertFieldChecked('edit-revision', "'Create new revision' checkbox is checked"); Chris@0: Chris@0: // Uncheck the create new revision checkbox and save the node. Chris@0: $edit = ['revision' => FALSE]; Chris@0: $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save'); Chris@0: Chris@0: $this->assertUrl($node->toUrl()); Chris@0: $this->assertNoLink(t('Revisions')); Chris@0: Chris@0: // Verify the checkbox is checked on the node edit form. Chris@0: $this->drupalGet('node/' . $node->id() . '/edit'); Chris@0: $this->assertFieldChecked('edit-revision', "'Create new revision' checkbox is checked"); Chris@0: Chris@0: // Submit the form without changing the checkbox. Chris@0: $edit = []; Chris@0: $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save'); Chris@0: Chris@0: $this->assertUrl($node->toUrl()); Chris@0: $this->assertLink(t('Revisions')); Chris@0: } Chris@0: Chris@0: }