public function WorkspaceTest::testWorkspaceFormRevisions in Drupal 10
Same name and namespace in other branches
- 8 core/modules/workspaces/tests/src/Functional/WorkspaceTest.php \Drupal\Tests\workspaces\Functional\WorkspaceTest::testWorkspaceFormRevisions()
- 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 150
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
->drupalGet($stage_workspace
->toUrl('edit-form')
->toString());
$this
->submitForm([], 'Save');
$stage_workspace = $storage
->loadUnchanged('stage');
$this
->assertEquals('2', $stage_workspace
->getRevisionId());
}