You are here

public function ImportEntityManagerTest::testEntityPresaveNodeHasLocalChange in Acquia Content Hub 8

Tests the entityPresave() method, node is has local change.

@covers ::entityPresave

File

tests/src/Unit/ImportEntityManagerTest.php, line 348

Class

ImportEntityManagerTest
PHPUnit test for the ImportEntityManager class.

Namespace

Drupal\Tests\acquia_contenthub\Unit

Code

public function testEntityPresaveNodeHasLocalChange() {
  $original_node = $this
    ->createMock('\\Drupal\\node\\NodeInterface');
  $node = $this
    ->createMock('\\Drupal\\node\\NodeInterface');
  $node->original = $original_node;
  $node
    ->expects($this
    ->once())
    ->method('getEntityTypeId')
    ->willReturn('node');
  $node
    ->expects($this
    ->once())
    ->method('id')
    ->willReturn(12);
  $this->contentHubEntitiesTracking
    ->expects($this
    ->once())
    ->method('loadImportedByDrupalEntity')
    ->with('node', 12)
    ->willReturn($this->contentHubEntitiesTracking);
  $this->contentHubEntitiesTracking
    ->expects($this
    ->once())
    ->method('isPendingSync')
    ->willReturn(FALSE);
  $this->contentHubEntitiesTracking
    ->expects($this
    ->once())
    ->method('hasLocalChange')
    ->willReturn(TRUE);
  $this->diffEntityComparison
    ->expects($this
    ->never())
    ->method('compareRevisions');
  $this->importEntityManager
    ->entityPresave($node);
}