You are here

public function ProxyConfigTest::testProxyConfiguration in Raven: Sentry Integration 8.2

Same name and namespace in other branches
  1. 3.x tests/src/Unit/ProxyConfigTest.php \Drupal\Tests\raven\Unit\ProxyConfigTest::testProxyConfiguration()

Test proxy configuration.

@dataProvider proxyConfigurationData

File

tests/src/Unit/ProxyConfigTest.php, line 259

Class

ProxyConfigTest
Test proxy configuration.

Namespace

Drupal\Tests\raven\Unit

Code

public function testProxyConfiguration($dsn, $config, $proxy) {
  $this->configFactory = $this
    ->getConfigFactoryStub([
    'raven.settings' => [
      'client_key' => $dsn,
      // We need this to avoid registering error handlers in
      // \Drupal\raven\Logger\Raven constructor.
      'fatal_error_handler' => FALSE,
    ],
  ]);
  new Settings([
    'http_client_config' => [
      'proxy' => $config,
    ],
  ]);
  $raven = new Raven($this->configFactory, $this->parser, $this->moduleHandler, $this->environment);
  if ($proxy === 'no') {
    self::assertEmpty($raven->client->http_proxy, 'No proxy configured for Raven_Client');
  }
  else {
    self::assertSame($config[$proxy], $raven->client->http_proxy, strtoupper($proxy) . ' proxy configured for Raven_Client');
  }
}