Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/node/tests/src/Functional/NodeRevisionsUiBypassAccessTest.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | c75dbcec494b |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
68 // Uncheck the create new revision checkbox and save the node. | 68 // Uncheck the create new revision checkbox and save the node. |
69 $edit = ['revision' => FALSE]; | 69 $edit = ['revision' => FALSE]; |
70 $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save'); | 70 $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save'); |
71 | 71 |
72 $this->assertUrl($node->toUrl()); | 72 $this->assertUrl($node->toUrl()); |
73 $this->assertNoLink(t('Revisions')); | 73 // Verify revisions exist since the content type has revisions enabled. |
74 $this->assertLink(t('Revisions')); | |
74 | 75 |
75 // Verify the checkbox is checked on the node edit form. | 76 // Verify the checkbox is checked on the node edit form. |
76 $this->drupalGet('node/' . $node->id() . '/edit'); | 77 $this->drupalGet('node/' . $node->id() . '/edit'); |
77 $this->assertFieldChecked('edit-revision', "'Create new revision' checkbox is checked"); | 78 $this->assertFieldChecked('edit-revision', "'Create new revision' checkbox is checked"); |
78 | 79 |
80 $edit = []; | 81 $edit = []; |
81 $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save'); | 82 $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save'); |
82 | 83 |
83 $this->assertUrl($node->toUrl()); | 84 $this->assertUrl($node->toUrl()); |
84 $this->assertLink(t('Revisions')); | 85 $this->assertLink(t('Revisions')); |
86 | |
87 // Unset page revision setting 'create new revision'. This will mean new | |
88 // revisions are not created by default when the node is edited. | |
89 $type = NodeType::load('page'); | |
90 $type->setNewRevision(FALSE); | |
91 $type->save(); | |
92 | |
93 // Create the node. | |
94 $node = $this->drupalCreateNode(); | |
95 | |
96 // Verify the checkbox is unchecked on the node edit form. | |
97 $this->drupalGet('node/' . $node->id() . '/edit'); | |
98 $this->assertNoFieldChecked('edit-revision', "'Create new revision' checkbox is unchecked"); | |
99 // Submit the form without changing the checkbox. | |
100 $edit = []; | |
101 $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save'); | |
102 | |
103 $this->assertUrl($node->toUrl()); | |
104 // Verify that no link to revisions is displayed since the type | |
105 // has the 'create new revision' setting unset. | |
106 $this->assertNoLink(t('Revisions')); | |
107 | |
108 // Verify the checkbox is unchecked on the node edit form. | |
109 $this->drupalGet('node/' . $node->id() . '/edit'); | |
110 $this->assertNoFieldChecked('edit-revision', "'Create new revision' checkbox is unchecked"); | |
111 | |
112 // Check the 'create new revision' checkbox and save the node. | |
113 $edit = ['revision' => TRUE]; | |
114 $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save'); | |
115 | |
116 $this->assertUrl($node->toUrl()); | |
117 // Verify that the link is displayed since a new revision is created and | |
118 // the 'create new revision' checkbox on the node is checked. | |
119 $this->assertLink(t('Revisions')); | |
85 } | 120 } |
86 | 121 |
87 } | 122 } |