public function AcquiaConnectorSpiTest::setUp in Acquia Connector 8
Same name and namespace in other branches
- 8.2 tests/src/Functional/AcquiaConnectorSpiTest.php \Drupal\Tests\acquia_connector\Functional\AcquiaConnectorSpiTest::setUp()
- 3.x tests/src/Functional/AcquiaConnectorSpiTest.php \Drupal\Tests\acquia_connector\Functional\AcquiaConnectorSpiTest::setUp()
Throws
\Drupal\Core\Entity\EntityStorageException
Overrides BrowserTestBase::setUp
File
- tests/
src/ Functional/ AcquiaConnectorSpiTest.php, line 211
Class
- AcquiaConnectorSpiTest
- Tests the functionality of the Acquia SPI module.
Namespace
Drupal\Tests\acquia_connector\FunctionalCode
public function setUp() {
if (empty($_SERVER['SERVER_SOFTWARE'])) {
$_SERVER['SERVER_SOFTWARE'] = $this
->randomString();
}
parent::setUp();
// Enable any modules required for the test
// Create and log in our privileged user.
$this->privilegedUser = $this
->drupalCreateUser([
'administer site configuration',
'access administration pages',
]);
$this
->drupalLogin($this->privilegedUser);
// Setup variables.
$this->environmentChangePath = '/admin/config/system/acquia-connector/environment-change';
$this->credentialsPath = 'admin/config/system/acquia-connector/credentials';
$this->settingsPath = 'admin/config/system/acquia-connector';
$this->statusReportUrl = 'admin/reports/status';
// Local env.
$config = \Drupal::configFactory()
->getEditable('acquia_connector.settings');
$config
->set('spi.server', 'http://mock-spi-server');
$config
->set('spi.ssl_verify', FALSE);
$config
->set('spi.ssl_override', TRUE);
// Set mapping for the test variables.
$mapping = $config
->get('mapping');
$mapping['test_variable_1'] = [
'state',
'test_variable_1',
];
$mapping['test_variable_2'] = [
'state',
'test_variable_2',
];
$mapping['test_variable_3'] = [
'state',
'test_variable_3',
];
$config
->set('mapping', $mapping);
$config
->save(TRUE);
// Set values for test variables.
\Drupal::state()
->set('test_variable_1', 1);
\Drupal::state()
->set('test_variable_2', 2);
\Drupal::state()
->set('test_variable_3', 3);
}