public function ContentHubEntitiesTrackingTest::testImportedDependentEntity in Acquia Content Hub 8
Test for Imported Dependent Entity.
@covers ::setDependent @covers ::isDependent
@expectedException \Exception
@expectedExceptionCode 0
@expectedExceptionMessage The "IS_DEPENDENT" status is immutable, and cannot be set again.
File
- tests/
src/ Unit/ ContentHubEntitiesTrackingTest.php, line 248
Class
- ContentHubEntitiesTrackingTest
- PHPUnit tests for the ContentHubEntitiesTracking class.
Namespace
Drupal\Tests\acquia_contenthub\UnitCode
public function testImportedDependentEntity() {
$entity = (object) [
'entity_type' => 'node',
'entity_id' => 1,
'entity_uuid' => '00000000-0000-0000-0000-000000000000',
'modified' => '2016-12-09T20:51:45+00:00',
'origin' => '11111111-1111-1111-1111-111111111111',
];
$this->contentHubEntitiesTracking = $this
->getContentHubEntitiesTrackingService();
$this->contentHubEntitiesTracking
->setImportedEntity($entity->entity_type, $entity->entity_id, $entity->entity_uuid, $entity->modified, $entity->origin);
$this->contentHubEntitiesTracking
->setDependent();
$this
->assertFalse($this->contentHubEntitiesTracking
->isAutoUpdate());
$this
->assertFalse($this->contentHubEntitiesTracking
->hasLocalChange());
$this
->assertFalse($this->contentHubEntitiesTracking
->isPendingSync());
$this
->assertTrue($this->contentHubEntitiesTracking
->isDependent());
// Set to another status should produce an Exception.
$this
->expectException(\Exception::class);
$this
->expectExceptionMessage('The "IS_DEPENDENT" status is immutable, and cannot be set again.');
$this->contentHubEntitiesTracking
->setLocalChange();
}