Skip to content

Commit

Permalink
tests, configure bypass-finals
Browse files Browse the repository at this point in the history
  • Loading branch information
brettmc committed Jan 13, 2025
1 parent a8fc516 commit 5fc05ec
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions tests/Unit/SDK/Common/Services/LoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,24 @@ public function priority(): int
$this->assertTrue($detector->getResource()->getAttributes()->has('foo-resource'));
$this->assertSame('foo', $detector->getResource()->getAttributes()->get('foo-resource'));
}

public function test_get_all_resource_detectors(): void
{
$detectors = Loader::resourceDetectors();
$this->assertIsArray($detectors);

Check failure on line 154 in tests/Unit/SDK/Common/Services/LoaderTest.php

View workflow job for this annotation

GitHub Actions / php (8.2, false)

RedundantCondition

tests/Unit/SDK/Common/Services/LoaderTest.php:154:16: RedundantCondition: Type array<array-key, OpenTelemetry\SDK\Resource\ResourceDetectorInterface> for $detectors is always array<array-key, mixed> (see https://psalm.dev/122)

Check failure on line 154 in tests/Unit/SDK/Common/Services/LoaderTest.php

View workflow job for this annotation

GitHub Actions / php (8.3, false)

RedundantCondition

tests/Unit/SDK/Common/Services/LoaderTest.php:154:16: RedundantCondition: Type array<array-key, OpenTelemetry\SDK\Resource\ResourceDetectorInterface> for $detectors is always array<array-key, mixed> (see https://psalm.dev/122)

Check failure on line 154 in tests/Unit/SDK/Common/Services/LoaderTest.php

View workflow job for this annotation

GitHub Actions / php (8.4, false, --ignore-platform-reqs)

RedundantCondition

tests/Unit/SDK/Common/Services/LoaderTest.php:154:16: RedundantCondition: Type array<array-key, OpenTelemetry\SDK\Resource\ResourceDetectorInterface> for $detectors is always array<array-key, mixed> (see https://psalm.dev/122)

Check failure on line 154 in tests/Unit/SDK/Common/Services/LoaderTest.php

View workflow job for this annotation

GitHub Actions / php (8.5, true, --ignore-platform-reqs)

RedundantCondition

tests/Unit/SDK/Common/Services/LoaderTest.php:154:16: RedundantCondition: Type array<array-key, OpenTelemetry\SDK\Resource\ResourceDetectorInterface> for $detectors is always array<array-key, mixed> (see https://psalm.dev/122)
$this->assertNotEmpty($detectors);
$this->assertContainsOnlyInstancesOf(ResourceDetectorInterface::class, $detectors);
}

public function test_missing_propagator(): void
{
$this->expectException(\RuntimeException::class);
Loader::textMapPropagator('missing');
}

public function test_missing_detector(): void
{
$this->expectException(\RuntimeException::class);
Loader::resourceDetector('missing');
}
}
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

require_once __DIR__ . '/../vendor/autoload.php';

BypassFinals::enable();
BypassFinals::enable(bypassReadOnly: false);

0 comments on commit 5fc05ec

Please sign in to comment.