You are here

public function MockIntegrationToggleKernelTest::testIntegrationToggleOff in Apigee Edge 8

Tests that the sdk client will use the mock handler stack.

File

tests/src/Kernel/MockIntegrationToggleKernelTest.php, line 73

Class

MockIntegrationToggleKernelTest
Tests the testing framework for testing offline.

Namespace

Drupal\Tests\apigee_edge\Kernel

Code

public function testIntegrationToggleOff() {
  $integration_enabled = getenv('APIGEE_INTEGRATION_ENABLE');
  putenv('APIGEE_INTEGRATION_ENABLE=0');
  $this
    ->enableModules([
    'apigee_mock_api_client',
  ]);
  $handler = $this->container
    ->get('apigee_mock_api_client.mock_http_client_factory')
    ->fromOptions([])
    ->getConfig('handler');
  self::assertInstanceOf(MockHandler::class, $handler);
  putenv('APIGEE_INTEGRATION_ENABLE=' . $integration_enabled ? 1 : 0);
}