You are here

public function ImportEntityManagerTest::testEntityPresaveNodeNotImported in Acquia Content Hub 8

Tests the entityPresave() method, node is not imported.

@covers ::entityPresave

File

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

Class

ImportEntityManagerTest
PHPUnit test for the ImportEntityManager class.

Namespace

Drupal\Tests\acquia_contenthub\Unit

Code

public function testEntityPresaveNodeNotImported() {
  $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(NULL);
  $this->diffEntityComparison
    ->expects($this
    ->never())
    ->method('compareRevisions');
  $this->importEntityManager
    ->entityPresave($node);
}