You are here

protected function AcquiaSearchOverrideTest::setUp in Acquia Connector 8

Overrides KernelTestBase::setUp

File

acquia_search/tests/src/Kernel/AcquiaSearchOverrideTest.php, line 33

Class

AcquiaSearchOverrideTest
Tests for Acquia Search override cores.

Namespace

Drupal\Tests\acquia_search\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installConfig([
    'acquia_connector',
  ]);
  $guzzle = $this
    ->createMock(Client::class);
  $guzzle
    ->expects($this
    ->any())
    ->method('__call')
    ->with('get')
    ->will($this
    ->returnValue(''));
  $client_factory = $this
    ->getMockBuilder('Drupal\\Core\\Http\\ClientFactory')
    ->disableOriginalConstructor()
    ->getMock();
  $client_factory
    ->expects($this
    ->any())
    ->method('fromOptions')
    ->will($this
    ->returnValue($guzzle));
  $this->container
    ->set('http_client_factory', $client_factory);
  $search_subscriber = new SearchSubscriber();

  /** @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface $event_dispatcher */
  $event_dispatcher = \Drupal::service('event_dispatcher');
  $event_dispatcher
    ->addSubscriber($search_subscriber);
}