Debian Codegraph @

tests/phpunit/unit/includes/libs/telemetry/NoopTracerTest.php

raw symbols SCIP
1 <?php
2 namespace Wikimedia\Tests\Telemetry;
3
4 use MediaWikiUnitTestCase;
5 use Wikimedia\Telemetry\NoopSpan;
6 use Wikimedia\Telemetry\NoopTracer;
7 use Wikimedia\Telemetry\SpanContext;
8 use Wikimedia\Telemetry\TracerInterface;
9
10 /**
11 * @covers \Wikimedia\Telemetry\NoopTracer
12 */
13 class NoopTracerTest extends MediaWikiUnitTestCase {
14 private TracerInterface $tracer;
15
16 protected function setUp(): void {
17 parent::setUp();
18
19 $this->tracer = new NoopTracer();
20 }
21
22 public function testShouldCreateNoopSpan(): void {
23 $span = $this->tracer->createSpan( 'test' );
24
25 $this->assertInstanceOf( NoopSpan::class, $span );
26 $this->assertNull( $span->getContext()->getParentSpanId() );
27 }
28
29 public function testShouldCreateNoopRootSpan(): void {
30 $span = $this->tracer->createRootSpan( 'test' );
31
32 $this->assertInstanceOf( NoopSpan::class, $span );
33 $this->assertNull( $span->getContext()->getParentSpanId() );
34 }
35
36 public function testShouldCreateNoopSpanWithParent(): void {
37 $span = $this->tracer->createSpanWithParent( 'test', new SpanContext( '', '', null, '', false ) );
38
39 $this->assertInstanceOf( NoopSpan::class, $span );
40 $this->assertNull( $span->getContext()->getParentSpanId() );
41 }
42 }