You are here

public function ConflictTrackerTest::testConflictTracker in Multiversion 8

Tests the Conflict Tracker.

File

tests/src/Functional/ConflictTrackerTest.php, line 34

Class

ConflictTrackerTest
Test the methods on the ConflictTracker class.

Namespace

Drupal\Tests\multiversion\Functional

Code

public function testConflictTracker() {
  $entity_1_conflicts = $this
    ->checkEntityConflicts();
  $entity_2_conflicts = $this
    ->checkEntityConflicts(6);
  $all_entities_conflicts = $entity_1_conflicts + $entity_2_conflicts;
  $all_tracker_conflicts = $this->conflictTracker
    ->getAll();
  $this
    ->assertEqual($all_entities_conflicts, $all_tracker_conflicts, 'Both entities conflicts are tracked in  workspace conflict tracker.');
  $entity_1_uuid = array_keys($entity_1_conflicts)[0];
  $this
    ->resolveConflicts($entity_1_uuid);

  // Check that after all conflicts have been resolved for entity 1 it is remove completely from the tracker.
  $all_tracker_conflicts = $this->conflictTracker
    ->getAll();
  $this
    ->assertEqual($entity_2_conflicts, $all_tracker_conflicts, 'Workspace conflicts only contain Entity 1\'s conflicts after Entity 2\' conflicts resolved.');
}