Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 1.0.x
  • 1.0.0-alpha1
2 results

Target

Select target project
  • project/workspaces_parallel
  • issue/workspaces_parallel-3473358
  • issue/workspaces_parallel-3483880
  • issue/workspaces_parallel-3483881
  • issue/workspaces_parallel-3491027
5 results
Select Git revision
  • 1.0.x
  • 3483881-automated-drupal-11
  • project-update-bot-only
  • 1.0.0-alpha1
4 results
Show changes
Commits on Source (7)
################
# DrupalCI GitLabCI template
#
# Gitlab-ci.yml to replicate DrupalCI testing for Contrib
#
# With thanks to:
# * The GitLab Acceleration Initiative participants
# * DrupalSpoons
################
################
# Guidelines
#
# This template is designed to give any Contrib maintainer everything they need to test, without requiring modification. It is also designed to keep up to date with Core Development automatically through the use of include files that can be centrally maintained.
#
# However, you can modify this template if you have additional needs for your project.
################
################
# Includes
#
# Additional configuration can be provided through includes.
# One advantage of include files is that if they are updated upstream, the changes affect all pipelines using that include.
#
# Includes can be overridden by re-declaring anything provided in an include, here in gitlab-ci.yml
# https://docs.gitlab.com/ee/ci/yaml/includes.html#override-included-configuration-values
################
include:
################
# DrupalCI includes:
# As long as you include this, any future includes added by the Drupal Association will be accessible to your pipelines automatically.
# View these include files at https://git.drupalcode.org/project/gitlab_templates/
################
- project: $_GITLAB_TEMPLATES_REPO
ref: $_GITLAB_TEMPLATES_REF
file:
- '/includes/include.drupalci.main.yml'
# EXPERIMENTAL: For Drupal 7, remove the above line and uncomment the below.
# - '/includes/include.drupalci.main-d7.yml'
- '/includes/include.drupalci.variables.yml'
- '/includes/include.drupalci.workflows.yml'
################
# Pipeline configuration variables
#
# These are the variables provided to the Run Pipeline form that a user may want to override.
#
# Docs at https://git.drupalcode.org/project/gitlab_templates/-/blob/1.0.x/includes/include.drupalci.variables.yml
################
# variables:
# SKIP_ESLINT: '1'
###################################################################################
#
# *
# /(
# ((((,
# /(((((((
# ((((((((((*
# ,(((((((((((((((
# ,(((((((((((((((((((
# ((((((((((((((((((((((((*
# *(((((((((((((((((((((((((((((
# ((((((((((((((((((((((((((((((((((*
# *(((((((((((((((((( .((((((((((((((((((
# ((((((((((((((((((. /(((((((((((((((((*
# /((((((((((((((((( .(((((((((((((((((,
# ,(((((((((((((((((( ((((((((((((((((((
# .(((((((((((((((((((( .(((((((((((((((((
# ((((((((((((((((((((((( ((((((((((((((((/
# (((((((((((((((((((((((((((/ ,(((((((((((((((*
# .((((((((((((((/ /(((((((((((((. ,(((((((((((((((
# *(((((((((((((( ,(((((((((((((/ *((((((((((((((.
# ((((((((((((((, /(((((((((((((. ((((((((((((((,
# (((((((((((((/ ,(((((((((((((* ,(((((((((((((,
# *((((((((((((( .((((((((((((((( ,(((((((((((((
# ((((((((((((/ /((((((((((((((((((. ,((((((((((((/
# ((((((((((((( *(((((((((((((((((((((((* *((((((((((((
# ((((((((((((( ,(((((((((((((..((((((((((((( *((((((((((((
# ((((((((((((, /((((((((((((* /((((((((((((/ ((((((((((((
# ((((((((((((( /((((((((((((/ (((((((((((((* ((((((((((((
# (((((((((((((/ /(((((((((((( ,((((((((((((, *((((((((((((
# (((((((((((((( *(((((((((((/ *((((((((((((. ((((((((((((/
# *((((((((((((((((((((((((((, /(((((((((((((((((((((((((
# ((((((((((((((((((((((((( ((((((((((((((((((((((((,
# .(((((((((((((((((((((((/ ,(((((((((((((((((((((((
# ((((((((((((((((((((((/ ,(((((((((((((((((((((/
# *((((((((((((((((((((( (((((((((((((((((((((,
# ,(((((((((((((((((((((, ((((((((((((((((((((/
# ,(((((((((((((((((((((* /((((((((((((((((((((
# ((((((((((((((((((((((, ,/((((((((((((((((((((,
# ,(((((((((((((((((((((((((((((((((((((((((((((((((((
# .(((((((((((((((((((((((((((((((((((((((((((((
# .((((((((((((((((((((((((((((((((((((,.
# .,(((((((((((((((((((((((((.
#
###################################################################################
......@@ -7,6 +7,6 @@ use Symfony\Component\Validator\Constraint;
class ParallelWorkspaceConflictConstraintValidator extends EntityWorkspaceConflictConstraintValidator {
public function validate($entity, Constraint $constraint) {}
public function validate($entity, Constraint $constraint): void {}
}
<?php
declare(strict_types=1);
namespace Drupal\Tests\workspaces_parallel\Functional;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\workspaces\Functional\WorkspaceTestUtilities;
/**
* Tests concurrent edits in different workspaces.
*
* @group workspaces
*/
class WorkspacesParallelConcurrentEditingTest extends BrowserTestBase {
use WorkspaceTestUtilities;
/**
* {@inheritdoc}
*/
protected static $modules = ['block', 'node', 'workspaces', 'workspaces_parallel'];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests editing a node in multiple workspaces.
*/
public function testConcurrentEditing(): void {
// Create a test node.
$this->createContentType(['type' => 'test', 'label' => 'Test']);
$this->setupWorkspaceSwitcherBlock();
$permissions = [
'create workspace',
'edit own workspace',
'view own workspace',
'create test content',
'edit own test content',
];
$mayer = $this->drupalCreateUser($permissions);
$this->drupalLogin($mayer);
$test_node = $this->createNodeThroughUi('Test node', 'test');
// Check that the user can edit the node.
$page = $this->getSession()->getPage();
$page->hasField('title[0][value]');
// Create two workspaces.
$vultures = $this->createWorkspaceThroughUi('Vultures', 'vultures');
$gravity = $this->createWorkspaceThroughUi('Gravity', 'gravity');
// Edit the node in workspace 'vultures'.
$this->switchToWorkspace($vultures);
$this->drupalGet('/node/' . $test_node->id() . '/edit');
$page = $this->getSession()->getPage();
$page->fillField('Title', 'Test node - override');
$page->findButton('Save')->click();
// Check that the user can still edit the node in the same workspace.
$this->drupalGet('/node/' . $test_node->id() . '/edit');
$page = $this->getSession()->getPage();
$this->assertTrue($page->hasField('title[0][value]'));
// Switch to a different workspace and check that the user can still edit
// the node.
$this->switchToWorkspace($gravity);
$this->drupalGet('/node/' . $test_node->id() . '/edit');
$page = $this->getSession()->getPage();
$this->assertTrue($page->hasField('title[0][value]'));
// Check that the node passes validation for API calls.
$violations = $test_node->validate();
$this->assertCount(0, $violations);
// Switch to the Live version of the site and check that the user still can
// edit the node.
$this->switchToLive();
$this->drupalGet('/node/' . $test_node->id() . '/edit');
$page = $this->getSession()->getPage();
$this->assertTrue($page->hasField('title[0][value]'));
// Check that the node passes validation for API calls.
$violations = $test_node->validate();
$this->assertCount(0, $violations);
}
}
<?php
declare(strict_types=1);
namespace Drupal\Tests\workspaces_parallel\Kernel;
use Drupal\KernelTests\KernelTestBase;
use Drupal\Tests\node\Traits\NodeCreationTrait;
use Drupal\Tests\user\Traits\UserCreationTrait;
use Drupal\Tests\workspaces\Kernel\WorkspaceTestTrait;
/**
* Test description.
*
* @group workspaces_parallel
*/
final class WorkspacesParallelTest extends KernelTestBase {
private $entityTypeManager;
use UserCreationTrait;
use NodeCreationTrait;
use WorkspaceTestTrait;
/**
* {@inheritdoc}
*/
protected static $modules = [
'system',
'node',
'user',
'workspaces',
'workspaces_parallel',
];
/**
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();
$this->entityTypeManager = \Drupal::entityTypeManager();
$this->installEntitySchema('node');
$this->installEntitySchema('user');
$this->installEntitySchema('workspace');
}
/**
* Test that the live workspace only pulls in a non-workspace revision during
* editing when loaded with EntityRepository::getActive().
*/
public function testParallelEditing(): void {
$this->initializeWorkspacesModule();
$node = \Drupal::entityTypeManager()->getStorage('node')->create([
'title' => 'Change in the live site',
'type' => 'page',
]);
$node->save();
$stage_ws = \Drupal::entityTypeManager()
->getStorage('workspace')
->load('stage');
$ws_manager = \Drupal::service('workspaces.manager');
$ws_manager->setActiveWorkspace($stage_ws);
$node->title = 'Change in stage site';
$node->save();
$ws_manager->switchToLive();
$nR = \Drupal::service('entity.repository')->getActive('node', $node->id());
// We should see the live site change, not the stage one, even though that
// is more recent.
self::assertEquals('Change in the live site', $nR->label());
}
}
name: 'Parallel Workspaces'
type: module
description: 'Support for parallel workspaces (content in multiple workspaces)'
core_version_requirement: ^10
core_version_requirement: ^10 || ^11
dependencies:
- workspaces