|
8 | 8 | use OpenTelemetry\API\Trace\SpanKind;
|
9 | 9 | use OpenTelemetry\API\Trace\TraceStateInterface;
|
10 | 10 | use OpenTelemetry\SDK\Common\Attribute\AttributesInterface;
|
| 11 | +use OpenTelemetry\SDK\Common\Instrumentation\InstrumentationScopeInterface; |
11 | 12 | use OpenTelemetry\SDK\Resource\ResourceInfo;
|
12 | 13 | use OpenTelemetry\SDK\Trace\EventInterface;
|
13 | 14 | use OpenTelemetry\SDK\Trace\LinkInterface;
|
@@ -78,6 +79,7 @@ class FriendlySpanConverterTest extends TestCase
|
78 | 79 | 'foz' => 'baz',
|
79 | 80 | ], ],
|
80 | 81 | ],
|
| 82 | + 'schema_url' => 'https://opentelemetry.io/schemas/1.25.0', |
81 | 83 | ];
|
82 | 84 |
|
83 | 85 | public function test_convert(): void
|
@@ -160,9 +162,23 @@ private function createSpanDataInterfaceMock(): SpanDataInterface
|
160 | 162 | }
|
161 | 163 | $mock->method('getLinks')->willReturn($links);
|
162 | 164 |
|
| 165 | + $mock->method('getInstrumentationScope') |
| 166 | + ->willReturn( |
| 167 | + $this->createInstrumentationScopeMock() |
| 168 | + ); |
| 169 | + |
163 | 170 | return $mock;
|
164 | 171 | }
|
165 | 172 |
|
| 173 | + private function createInstrumentationScopeMock(): InstrumentationScopeInterface |
| 174 | + { |
| 175 | + $mock = $this->createMock(InstrumentationScopeInterface::class); |
| 176 | + |
| 177 | + $mock->method('getSchemaUrl') |
| 178 | + ->willReturn($this->createSchemaUrlMock()); |
| 179 | + |
| 180 | + return $mock; |
| 181 | + } |
166 | 182 | private function createSpanContextMock(string $spanId, string $traceId = '0', string $traceState = null): SpanContextInterface
|
167 | 183 | {
|
168 | 184 | $mock = $this->createMock(SpanContextInterface::class);
|
@@ -249,4 +265,9 @@ public function createLinkInterfaceMock(SpanContextInterface $context, Attribute
|
249 | 265 |
|
250 | 266 | return $mock;
|
251 | 267 | }
|
| 268 | + |
| 269 | + public function createSchemaUrlMock(): string |
| 270 | + { |
| 271 | + return self::TEST_DATA['schema_url']; |
| 272 | + } |
252 | 273 | }
|
0 commit comments