You are here

public function AutoConnectorTest::testAutoConnectWhenNoCredsInGlobalConfig in Acquia Connector 8

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

Tests auto connect.

Tests the scenario when the site is not connected but there are no credentials provided by the global config.

File

tests/src/Unit/AutoConnectorTest.php, line 80

Class

AutoConnectorTest
@coversDefaultClass \Drupal\acquia_connector\AutoConnector

Namespace

Drupal\Tests\acquia_connector\Unit

Code

public function testAutoConnectWhenNoCredsInGlobalConfig() {
  $subscription_mock = $this
    ->prophesize(Subscription::CLASS);
  $subscription_mock
    ->hasCredentials()
    ->willReturn(FALSE);
  $subscription_mock
    ->update()
    ->shouldNotBeCalled();
  $storage_mock = $this
    ->prophesize(Storage::CLASS);
  $storage_mock
    ->setKey()
    ->shouldNotBeCalled();
  $storage_mock
    ->setIdentifier()
    ->shouldNotBeCalled();
  $config = [];
  $auto_connector = new AutoConnector($subscription_mock
    ->reveal(), $storage_mock
    ->reveal(), $config);
  $auto_connected = $auto_connector
    ->connectToAcquia();
  $this
    ->assertFalse($auto_connected);
}