public function ImportEntityManagerTest::testImportRemoteEntityMissingEntityWithRequiredBundle in Acquia Content Hub 8
Tests the importRemoteEntity() method.
@covers ::entityPresave
File
- tests/
src/ Unit/ ImportEntityManagerTest.php, line 519
Class
- ImportEntityManagerTest
- PHPUnit test for the ImportEntityManager class.
Namespace
Drupal\Tests\acquia_contenthub\UnitCode
public function testImportRemoteEntityMissingEntityWithRequiredBundle() {
$uuid = '11111111-1111-1111-1111-111111111111';
$site_origin = '11111111-2222-1111-1111-111111111111';
$entity_ch = $this
->createContentHubEntity([
'uuid' => $uuid,
]);
$this->contentHubEntitiesTracking
->expects($this
->any())
->method('getSiteOrigin')
->willReturn($site_origin);
$this->clientManager
->expects($this
->any())
->method('createRequest')
->with('readEntity', [
$uuid,
])
->willReturn($entity_ch);
$this->entityManager
->expects($this
->any())
->method('getAllowedEntityTypes')
->willReturn([
'node' => [
'test' => 'Test content type',
],
]);
$loggerChannelInterface = $this
->createMock('\\Drupal\\Core\\Logger\\LoggerChannelInterface');
$this->loggerFactory
->expects($this
->once())
->method('get')
->with('acquia_contenthub')
->willReturn($loggerChannelInterface);
$loggerChannelInterface
->expects($this
->any())
->method('warning');
$result = $this->importEntityManager
->importRemoteEntity($uuid, FALSE);
$status_code = json_decode($result
->getStatusCode());
$this
->assertEquals($status_code, 403);
}