blob: 43a30364275cb68046afbbe340ceffe888829683 (
plain)
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
48
49
|
<?php
namespace Jaeger\Tests;
use Jaeger\ScopeManager;
use Jaeger\Span;
use PHPUnit\Framework\TestCase;
class ScopeManagerTest extends TestCase
{
/**
* @var ScopeManager
*/
private $scopeManager;
function setUp(): void
{
$this->scopeManager = new ScopeManager();
}
function testActivate()
{
$span = $this->createMock(Span::class);
$scope = $this->scopeManager->activate($span, true);
$this->assertEquals($scope->getSpan(), $span);
}
function testAbleGetActiveScope()
{
$span = $this->createMock(Span::class);
$this->assertNull($this->scopeManager->getActive());
$scope = $this->scopeManager->activate($span, false);
$this->assertEquals($scope, $this->scopeManager->getActive());
}
function testScopeClosingDeactivates()
{
$span = $this->createMock(Span::class);
$scope = $this->scopeManager->activate($span, false);
$scope->close();
$this->assertNull($this->scopeManager->getActive());
}
}
|