public function WorkspaceTest::testWorkspaceFormRevisions in Drupal 8
Same name and namespace in other branches
- 9 core/modules/workspaces/tests/src/Functional/WorkspaceTest.php \Drupal\Tests\workspaces\Functional\WorkspaceTest::testWorkspaceFormRevisions()
Tests that editing a workspace creates a new revision.
File
- core/
modules/ workspaces/ tests/ src/ Functional/ WorkspaceTest.php, line 135
Class
- WorkspaceTest
- Test the workspace entity.
Namespace
Drupal\Tests\workspaces\FunctionalCode
public function testWorkspaceFormRevisions() {
$this
->drupalLogin($this->editor1);
$storage = \Drupal::entityTypeManager()
->getStorage('workspace');
// The current 'stage' workspace entity should be revision 1.
$stage_workspace = $storage
->load('stage');
$this
->assertEquals('1', $stage_workspace
->getRevisionId());
// Re-save the 'stage' workspace via the UI to create revision 2.
$this
->drupalPostForm($stage_workspace
->toUrl('edit-form')
->toString(), [], 'Save');
$stage_workspace = $storage
->loadUnchanged('stage');
$this
->assertEquals('2', $stage_workspace
->getRevisionId());
}