diff --git a/tests/Unit/SDK/SdkTest.php b/tests/Unit/SDK/SdkTest.php index 85007ec22..27d3ecca6 100644 --- a/tests/Unit/SDK/SdkTest.php +++ b/tests/Unit/SDK/SdkTest.php @@ -5,6 +5,7 @@ namespace OpenTelemetry\Tests\Unit\SDK; use AssertWell\PHPUnitGlobalState\EnvironmentVariables; +use Composer\InstalledVersions; use OpenTelemetry\Context\Propagation\TextMapPropagatorInterface; use OpenTelemetry\SDK\Common\Configuration\Variables; use OpenTelemetry\SDK\Logs\LoggerProviderInterface; @@ -83,6 +84,14 @@ public function test_developer_mode_auto_detected(): void $this->assertTrue(Sdk::isDeveloperModeEnabled()); } + public function test_developer_mode_check_handles_exceptions(): void + { + $mock = \Mockery::mock('alias:' . InstalledVersions::class); + $mock->expects('getRootPackage')->andThrow(\Exception::class); + + $this->assertFalse(Sdk::isDeveloperModeEnabled()); + } + public function test_builder(): void { $this->assertInstanceOf(SdkBuilder::class, Sdk::builder());