You are here

protected function AcquiadamConfigFormTest::getMockedAcquidamConfig in Media: Acquia DAM 8

Get a partially mocked AcquiadamConfig object.

Return value

\PHPUnit\Framework\MockObject\MockObject|\Drupal\media_acquiadam\Form\AcquiadamConfig A mocked version of the AcquiadamConfig form class.

Throws

\Exception

1 call to AcquiadamConfigFormTest::getMockedAcquidamConfig()
AcquiadamConfigFormTest::setUp in tests/src/Unit/AcquiadamConfigFormTest.php

File

tests/src/Unit/AcquiadamConfigFormTest.php, line 264

Class

AcquiadamConfigFormTest
Config form test.

Namespace

Drupal\Tests\media_acquiadam\Unit

Code

protected function getMockedAcquidamConfig() {
  $messenger = $this
    ->getMockBuilder(Messenger::class)
    ->setMethods([
    'addWarning',
    'addStatus',
  ])
    ->disableOriginalConstructor()
    ->getMock();
  $config = $this
    ->getMockBuilder(AcquiadamConfig::class)
    ->setConstructorArgs([
    $this->container
      ->get('config.factory'),
    $this->container
      ->get('media_acquiadam.client_factory'),
    new BatchBuilder(),
    $this->container
      ->get('datetime.time'),
    $this->container
      ->get('plugin.manager.queue_worker'),
    $this->container
      ->get('state'),
  ])
    ->setMethods([
    'batchSet',
    'getActiveMediaIds',
    'messenger',
  ])
    ->getMock();
  $config
    ->method('messenger')
    ->willReturn($messenger);
  return $config;
}