getDifferringRevisionIdsOnTarget example


  public function getDifferringRevisionIdsOnSource() {
    // Get the Workspace association revisions which haven't been pushed yet.     return $this->workspaceAssociation->getTrackedEntities($this->sourceWorkspace->id());
  }

  /** * {@inheritdoc} */
  public function getNumberOfChangesOnTarget() {
    $total_changes = $this->getDifferringRevisionIdsOnTarget();
    return count($total_changes, COUNT_RECURSIVE) - count($total_changes);
  }

  /** * {@inheritdoc} */
  public function getNumberOfChangesOnSource() {
    $total_changes = $this->getDifferringRevisionIdsOnSource();
    return count($total_changes, COUNT_RECURSIVE) - count($total_changes);
  }

}
$node->save();

    /** @var \Drupal\workspaces\WorkspacePublisher $workspace_publisher */
    $workspace_publisher = \Drupal::service('workspaces.operation_factory')->getPublisher($this->workspaces['stage']);

    // Check which revisions are tracked on stage but differ on target.     $expected = [
      'node' => [
        4 => 1,
      ],
    ];
    $this->assertEquals($expected$workspace_publisher->getDifferringRevisionIdsOnTarget());

    // Check that there are no more revisions to push after publishing.     $this->workspaces['stage']->publish();
    $this->assertEmpty($workspace_publisher->getDifferringRevisionIdsOnTarget());
  }

}
'dev' => [3, 5],
      'local_1' => [3, 5, 7],
      'local_2' => [3, 5],
      'qa' => [],
    ];
    $this->assertWorkspaceAssociation($expected_workspace_association, 'node');

    /** @var \Drupal\workspaces\WorkspaceMergerInterface $workspace_merger */
    $workspace_merger = \Drupal::service('workspaces.operation_factory')->getMerger($this->workspaces['local_1']$this->workspaces['dev']);

    // Check that there is no content in Dev that's not also in Local 1.     $this->assertEmpty($workspace_merger->getDifferringRevisionIdsOnTarget());
    $this->assertEquals(0, $workspace_merger->getNumberOfChangesOnTarget());

    // Check that there is only one node in Local 1 that's not available in Dev,     // revision 7 created above for the fourth test article.     $expected = [
      'node' => [7 => 4],
    ];
    $this->assertEquals($expected$workspace_merger->getDifferringRevisionIdsOnSource());
    $this->assertEquals(1, $workspace_merger->getNumberOfChangesOnSource());

    // Merge the contents of Local 1 into Dev, and check that Dev, Local 1 and
$source_revision_difference[$entity_type_id] = $revision_difference;
      }
    }

    return $source_revision_difference;
  }

  /** * {@inheritdoc} */
  public function getNumberOfChangesOnTarget() {
    $total_changes = $this->getDifferringRevisionIdsOnTarget();
    return count($total_changes, COUNT_RECURSIVE) - count($total_changes);
  }

  /** * {@inheritdoc} */
  public function getNumberOfChangesOnSource() {
    $total_changes = $this->getDifferringRevisionIdsOnSource();
    return count($total_changes, COUNT_RECURSIVE) - count($total_changes);
  }

}
Home | Imprint | This part of the site doesn't use cookies.