You are here

protected function AuthenticationFormJsTest::setUp in Apigee Edge 8

Overrides ApigeeEdgeFunctionalJavascriptTestBase::setUp

File

tests/src/FunctionalJavascript/Form/AuthenticationFormJsTest.php, line 87

Class

AuthenticationFormJsTest
Apigee Edge API credentials, authentication form, key integration test.

Namespace

Drupal\Tests\apigee_edge\FunctionalJavascript\Form

Code

protected function setUp() {
  parent::setUp();

  // Save valid credentials for later use.

  /** @var \Drupal\apigee_edge\Plugin\EdgeKeyTypeInterface $test_key_type */
  $test_key = Key::load($this
    ->config(AuthenticationForm::CONFIG_NAME)
    ->get('active_key'));
  $test_key_type = $test_key
    ->getKeyType();
  $this->instanceType = $test_key_type
    ->getInstanceType($test_key);
  $this->organization = $test_key_type
    ->getOrganization($test_key);
  if ($this->instanceType != EdgeKeyTypeInterface::INSTANCE_TYPE_HYBRID) {
    $this->username = $test_key_type
      ->getUsername($test_key);
    $this->password = $test_key_type
      ->getPassword($test_key);
    $this->endpoint = $test_key_type
      ->getEndpoint($test_key);
  }
  else {
    $this->account_key = $test_key_type
      ->getAccountKey($test_key);
  }

  // Restore the default HTTP timeout set by the testing module because
  // we would like to run a test that tries to connect to an invalid
  // endpoint and we should not wait 6 minutes for the result.
  $this
    ->config('apigee_edge.client')
    ->set('http_client_timeout', 30)
    ->save();
}