-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathOpenTelemetryHookTest.php
47 lines (36 loc) · 1.08 KB
/
OpenTelemetryHookTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
declare(strict_types=1);
namespace OpenFeature\Hooks\OpenTelemetry\Test\integration;
use OpenFeature\Hooks\OpenTelemetry\OpenTelemetryHook;
use OpenFeature\Hooks\OpenTelemetry\Test\TestCase;
use OpenFeature\OpenFeatureAPI;
use OpenFeature\interfaces\hooks\Hook;
class OpenTelemetryHookTest extends TestCase
{
public function testAutoload(): void
{
// Given
$api = OpenFeatureAPI::getInstance();
$api->clearHooks();
// When
$this->simulateAutoload();
// Then
$this->assertCount(1, $api->getHooks());
$this->assertInstanceOf(Hook::class, $api->getHooks()[0]);
}
public function testCanBeRegistered(): void
{
// Given
$api = OpenFeatureAPI::getInstance();
$api->clearHooks();
// When
OpenTelemetryHook::register();
// Then
$this->assertCount(1, $api->getHooks());
$this->assertInstanceOf(Hook::class, $api->getHooks()[0]);
}
private function simulateAutoload(): void
{
require __DIR__ . '/../../src/_autoload.php';
}
}