You are here

protected function AcquiaSearchTest::setUp in Acquia Connector 8

Overrides UnitTestCase::setUp

File

acquia_search/tests/src/Unit/AcquiaSearchTest.php, line 56

Class

AcquiaSearchTest
Isolated tests for Acquia Search.

Namespace

Drupal\Tests\acquia_search\Unit

Code

protected function setUp() {

  // Generate and store a random set of credentials.
  // Make them as close to the production values as possible
  // Something like AAAA-1234.
  $this->id = $this
    ->randomMachineName(10);

  // Most of the keys and salts have a 32char length.
  $this->key = $this
    ->randomMachineName(32);
  $this->salt = $this
    ->randomMachineName(32);

  // Include Solarium autoloader.
  $dirs = drupal_phpunit_contrib_extension_directory_roots();
  $extensions = [];
  foreach ($dirs as $path) {
    $extensions += drupal_phpunit_find_extension_directories($path);
  }
  unset($extensions);
  $this->searchSubscriber = new SearchSubscriber();
  $this->derivedKey = CryptConnector::createDerivedKey($this->salt, $this->id, $this->key);
}