You are here

protected function AcquiadamKernelTestBase::setTestClient in Media: Acquia DAM 8

Sets a test client for this test.

1 call to AcquiadamKernelTestBase::setTestClient()
AcquiadamKernelTestBase::setUp in tests/src/Kernel/AcquiadamKernelTestBase.php

File

tests/src/Kernel/AcquiadamKernelTestBase.php, line 62

Class

AcquiadamKernelTestBase
Base class for Acquia DAM kernel tests.

Namespace

Drupal\Tests\media_acquiadam\Kernel

Code

protected function setTestClient() {
  $this->testClient = new TestClient();
  $acquiadam_client_factory = $this
    ->getMockBuilder(ClientFactory::class)
    ->disableOriginalConstructor()
    ->getMock();
  $acquiadam_client_factory
    ->expects($this
    ->any())
    ->method('get')
    ->willReturn($this->testClient);
  $this->container
    ->set('media_acquiadam.client_factory', $acquiadam_client_factory);
  \Drupal::setContainer($this->container);
}