You are here

public function TelemetryTest::testErrorSuppression in Lightning Core 8.3

Same name and namespace in other branches
  1. 8.4 modules/acquia_telemetry/tests/src/Kernel/TelemetryTest.php \Drupal\Tests\acquia_telemetry\Kernel\TelemetryTest::testErrorSuppression()

File

modules/acquia_telemetry/tests/src/Kernel/TelemetryTest.php, line 23

Class

TelemetryTest
@group lightning @group lightning_core @group acquia_telemetry

Namespace

Drupal\Tests\acquia_telemetry\Kernel

Code

public function testErrorSuppression() {
  $http_client = $this
    ->prophesize(ClientInterface::class);
  $http_client
    ->request(Argument::cetera())
    ->willThrow('Exception');
  $this->container
    ->set('http_client', $http_client
    ->reveal());
  $telemetry = $this->container
    ->get('acquia.telemetry');
  $this
    ->assertFalse($telemetry
    ->sendTelemetry('Foobaz'));
  $this->container
    ->get('state')
    ->set('acquia_telemetry.loud', TRUE);
  $this
    ->setExpectedException('Exception');
  $telemetry
    ->sendTelemetry('Blow up real good!');
}