diff --git a/tests/Jaeger/Codec/TextCodecTest.php b/tests/Jaeger/Codec/TextCodecTest.php index 6ca060e..c886d10 100644 --- a/tests/Jaeger/Codec/TextCodecTest.php +++ b/tests/Jaeger/Codec/TextCodecTest.php @@ -27,4 +27,27 @@ public function testCanInjectContextInCarrier() $this->assertFalse(empty($carrier)); } + + public function testSpanContextParsingFromHeader() + { + $carrier = ['uber-trace-id' => '32834e4115071776:f7802330248418d:32834e4115071776:1']; + + $spanContext = $this->textCodec->extract($carrier); + + self::assertEquals("1717370599544170", $spanContext->getTraceId()); + self::assertEquals("641546560935337", $spanContext->getSpanId()); + self::assertEquals("1717370599544170", $spanContext->getParentId()); + self::assertEquals(1, $spanContext->getFlags()); + } + + /** + * @expectedException Exception + * @expectedExceptionMessage Malformed tracer state string + */ + public function testInvalidSpanContextParsingFromHeader() + { + $carrier = ['uber-trace-id' => 'invalid_data']; + + $this->textCodec->extract($carrier); + } } diff --git a/tests/TextCodecTest.php b/tests/TextCodecTest.php deleted file mode 100644 index a319b53..0000000 --- a/tests/TextCodecTest.php +++ /dev/null @@ -1,40 +0,0 @@ -textCodec = new TextCodec(); - } - - public function testSpanContextParsingFromHeader() - { - $carrier = ['uber-trace-id' => '32834e4115071776:f7802330248418d:32834e4115071776:1']; - - $spanContext = $this->textCodec->extract($carrier); - - self::assertEquals("1717370599544170", $spanContext->getTraceId()); - self::assertEquals("641546560935337", $spanContext->getSpanId()); - self::assertEquals("1717370599544170", $spanContext->getParentId()); - self::assertEquals(1, $spanContext->getFlags()); - } - - /** - * @expectedException Exception - * @expectedExceptionMessage Malformed tracer state string - */ - public function testInvalidSpanContextParsingFromHeader() - { - $carrier = ['uber-trace-id' => 'invalid_data']; - - $this->textCodec->extract($carrier); - } -}