You are here

public function AcquiaConnectorModuleTest::setUp in Acquia Connector 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/AcquiaConnectorModuleTest.php \Drupal\Tests\acquia_connector\Functional\AcquiaConnectorModuleTest::setUp()
  2. 3.x tests/src/Functional/AcquiaConnectorModuleTest.php \Drupal\Tests\acquia_connector\Functional\AcquiaConnectorModuleTest::setUp()

Overrides BrowserTestBase::setUp

File

tests/src/Functional/AcquiaConnectorModuleTest.php, line 179

Class

AcquiaConnectorModuleTest
Tests the functionality of the Acquia Connector module.

Namespace

Drupal\Tests\acquia_connector\Functional

Code

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

  // Create and log in our privileged user.
  $this->privilegedUser = $this
    ->drupalCreateUser([
    'administer site configuration',
    'access administration pages',
    'access toolbar',
  ]);
  $this
    ->drupalLogin($this->privilegedUser);

  // Create a user that has a Network subscription.
  $this->networkUser = $this
    ->drupalCreateUser();
  $this->networkUser->mail = $this->acqtestEmail;
  $this->networkUser->pass = $this->acqtestPass;
  $this->networkUser
    ->save();

  // $this->drupalLogin($this->network_user);
  // Setup variables.
  $this->cloudFreeUrl = 'https://www.acquia.com/acquia-cloud-free';
  $this->setupPath = 'admin/config/system/acquia-connector/setup';
  $this->credentialsPath = 'admin/config/system/acquia-connector/credentials';
  $this->settingsPath = 'admin/config/system/acquia-connector';
  $this->environmentChangePath = '/admin/config/system/acquia-connector/environment-change';
  $this->statusReportUrl = 'admin/reports/status';
  \Drupal::configFactory()
    ->getEditable('acquia_connector.settings')
    ->set('spi.server', 'http://mock-spi-server')
    ->save();
  \Drupal::configFactory()
    ->getEditable('acquia_connector.settings')
    ->set('spi.ssl_verify', FALSE)
    ->save();
  \Drupal::configFactory()
    ->getEditable('acquia_connector.settings')
    ->set('spi.ssl_override', TRUE)
    ->save();

  // Create a node, since some SPI data is only gathered if nodes exist.
  $this
    ->createContentType([
    'type' => 'test_content_type',
    'name' => 'Test content type',
  ]);
  $this
    ->createNode([
    'type' => 'test_content_type',
    'title' => 'Dummy node',
    'body' => [
      [
        'value' => 'Dummy node body',
      ],
    ],
  ]);
}