You are here

protected function UnserializationTest::setUp in Acquia Content Hub 8.2

Throws

\Exception

Overrides EntityKernelTestBase::setUp

1 call to UnserializationTest::setUp()
ImportQueueWorkerLoggingTest::setUp in tests/src/Kernel/ImportQueueWorkerLoggingTest.php
1 method overrides UnserializationTest::setUp()
ImportQueueWorkerLoggingTest::setUp in tests/src/Kernel/ImportQueueWorkerLoggingTest.php

File

tests/src/Kernel/UnserializationTest.php, line 88

Class

UnserializationTest
Tests that entities are properly unserialized.

Namespace

Drupal\Tests\acquia_contenthub\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('taxonomy_term');
  $this
    ->installSchema('acquia_contenthub_subscriber', [
    'acquia_contenthub_subscriber_import_tracking',
  ]);
  $this->contentHubClient = $this
    ->prophesize(ContentHubClient::class);
  $this->settings = $this
    ->prophesize(Settings::class);
  $this->settings
    ->getWebhook('uuid')
    ->willReturn('foo');
  $this->settings
    ->getName()
    ->willReturn('foo');
  $this->settings
    ->getUuid()
    ->willReturn(self::CLIENT_UUID_1);
  $client_factory_mock = $this
    ->prophesize(ClientFactory::class);
  $client_factory_mock
    ->getClient()
    ->willReturn($this->contentHubClient);
  $client_factory_mock
    ->getSettings()
    ->willReturn($this->settings
    ->reveal());
  $this->container
    ->set('acquia_contenthub.client.factory', $client_factory_mock
    ->reveal());
  $subscriber_tracker_mock = $this
    ->prophesize(SubscriberTracker::class);
  $this->container
    ->set('acquia_contenthub_subscriber.tracker', $subscriber_tracker_mock
    ->reveal());
  $logger_channel_mock = $this
    ->prophesize(LoggerChannelInterface::class);
  $this->container
    ->set('acquia_contenthub.logger_channel', $logger_channel_mock
    ->reveal());
  $common = $this
    ->getMockBuilder(ContentHubCommonActions::class)
    ->setConstructorArgs([
    $this->container
      ->get('event_dispatcher'),
    $this->container
      ->get('entity.cdf.serializer'),
    $this->container
      ->get('entity.dependency.calculator'),
    $this->container
      ->get('acquia_contenthub.client.factory'),
    $this->container
      ->get('logger.factory'),
    $this->container
      ->get('config.factory'),
  ])
    ->setMethods([
    'getUpdateDbStatus',
  ])
    ->getMock();
  $this->container
    ->set('acquia_contenthub_common_actions', $common);
  $this->contentHubImportQueueWorker = $this
    ->getMockBuilder(ContentHubImportQueueWorker::class)
    ->setConstructorArgs([
    $this->container
      ->get('event_dispatcher'),
    $this->container
      ->get('acquia_contenthub_common_actions'),
    $this->container
      ->get('acquia_contenthub.client.factory'),
    $this->container
      ->get('acquia_contenthub_subscriber.tracker'),
    $this->container
      ->get('logger.factory'),
    $this->container
      ->get('config.factory'),
    [],
    NULL,
    NULL,
  ])
    ->setMethods(NULL)
    ->getMock();
}