You are here

public function RuntimeTest::testIsAcquiaServer in Acquia Search 3.x

Tests isAcquiaServer.

@covers \Drupal\acquia_search\Helper\Runtime::isAcquiaServer

File

tests/src/Unit/Helper/RuntimeTest.php, line 184

Class

RuntimeTest
@coversDefaultClass \Drupal\acquia_search\Helper\Runtime @group Acquia Search Solr

Namespace

Drupal\Tests\acquia_search\Unit\Helper

Code

public function testIsAcquiaServer() {
  $server = $this
    ->prophesize(Server::class);
  $server
    ->getBackendConfig()
    ->willReturn([]);
  $this
    ->assertFalse(Runtime::isAcquiaServer($server
    ->reveal()));
  $server
    ->getBackendConfig()
    ->willReturn([
    'connector',
  ]);
  $this
    ->assertFalse(Runtime::isAcquiaServer($server
    ->reveal()));
  $server
    ->getBackendConfig()
    ->willReturn([
    'connector' => NULL,
  ]);
  $this
    ->assertFalse(Runtime::isAcquiaServer($server
    ->reveal()));
  $server
    ->getBackendConfig()
    ->willReturn([
    'connector' => FALSE,
  ]);
  $this
    ->assertFalse(Runtime::isAcquiaServer($server
    ->reveal()));
  $server
    ->getBackendConfig()
    ->willReturn([
    'connector' => 0,
  ]);
  $this
    ->assertFalse(Runtime::isAcquiaServer($server
    ->reveal()));
  $server
    ->getBackendConfig()
    ->willReturn([
    'connector' => 1,
  ]);
  $this
    ->assertFalse(Runtime::isAcquiaServer($server
    ->reveal()));
  $server
    ->getBackendConfig()
    ->willReturn([
    'connector' => '0',
  ]);
  $this
    ->assertFalse(Runtime::isAcquiaServer($server
    ->reveal()));
  $server
    ->getBackendConfig()
    ->willReturn([
    'connector' => '1',
  ]);
  $this
    ->assertFalse(Runtime::isAcquiaServer($server
    ->reveal()));
  $server
    ->getBackendConfig()
    ->willReturn([
    'connector' => 'solr_acquia_connector',
  ]);
  $this
    ->assertTrue(Runtime::isAcquiaServer($server
    ->reveal()));
}