You are here

protected function ImportFromFiltersTest::alterContentHubMockPostCallback in Acquia Content Hub 8.2

Alters ContentHub client mock.

Depending on test data a specified set of responses will return.

Parameters

string $responsesStackId: Responses stack id.

1 call to ImportFromFiltersTest::alterContentHubMockPostCallback()
ImportFromFiltersTest::testImportFromFilters in tests/src/Kernel/ImportFromFiltersTest.php
Tests import from filter.

File

tests/src/Kernel/ImportFromFiltersTest.php, line 296

Class

ImportFromFiltersTest
Tests that imports from filters work properly.

Namespace

Drupal\Tests\acquia_contenthub\Kernel

Code

protected function alterContentHubMockPostCallback(string $responsesStackId) {
  $clientFactory = $this
    ->getMockBuilder(ClientFactory::class)
    ->disableOriginalConstructor()
    ->getMock();
  $responses = $this
    ->responsesStackById($responsesStackId);
  $this->contentHubClientMock
    ->method('post')
    ->will($this
    ->onConsecutiveCalls(...$responses));
  $clientFactory
    ->method('getClient')
    ->willReturn($this->contentHubClientMock);
  $this->container
    ->set('acquia_contenthub.client.factory', $clientFactory);
}