-
Notifications
You must be signed in to change notification settings - Fork 223
Expand file tree
/
Copy pathMetadataTest.php
More file actions
47 lines (35 loc) · 1.15 KB
/
MetadataTest.php
File metadata and controls
47 lines (35 loc) · 1.15 KB
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 OpenTelemetry\Tests\Unit\API\Baggage;
use OpenTelemetry\API\Baggage\Metadata;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
#[CoversClass(Metadata::class)]
class MetadataTest extends TestCase
{
public function test_get_value(): void
{
$metadata = new Metadata('some-metadata');
$this->assertSame('some-metadata', $metadata->getValue());
}
public function test_get_empty_returns_metadata_with_empty_value(): void
{
$metadata = Metadata::getEmpty();
$this->assertSame('', $metadata->getValue());
}
public function test_get_empty_returns_same_instance(): void
{
$this->assertSame(Metadata::getEmpty(), Metadata::getEmpty());
}
public function test_constructor_with_empty_string(): void
{
$metadata = new Metadata('');
$this->assertSame('', $metadata->getValue());
}
public function test_constructor_with_complex_value(): void
{
$value = 'key1=value1;key2=value2';
$metadata = new Metadata($value);
$this->assertSame($value, $metadata->getValue());
}
}