blob: ef95ebfe70154e659707d0989f1fe050b7eca585 (
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
50
51
52
|
<?php
namespace Jaeger\Tests\Reporter;
use Jaeger\Reporter\CompositeReporter;
use Jaeger\Reporter\ReporterInterface;
use Jaeger\Span;
use PHPUnit\Framework\TestCase;
class CompositeReporterTest extends TestCase
{
/** @var CompositeReporter */
private $reporter;
/** @var ReporterInterface|\PHPUnit\Framework\MockObject\MockObject */
private $childReporter1;
/** @var ReporterInterface|\PHPUnit\Framework\MockObject\MockObject */
private $childReporter2;
/**
* {@inheritdoc}
*/
public function setUp(): void
{
$this->childReporter1 = $this->createMock(ReporterInterface::class);
$this->childReporter2 = $this->createMock(ReporterInterface::class);
$this->reporter = new CompositeReporter($this->childReporter1, $this->childReporter2);
}
/** @test */
public function shouldReportSpan()
{
/** @var \Jaeger\Span|\PHPUnit\Framework\MockObject\MockObject $span */
$span = $this->createMock(Span::class);
$this->childReporter1->expects($this->once())->method('reportSpan')->with($span);
$this->childReporter2->expects($this->once())->method('reportSpan')->with($span);
$this->reporter->reportSpan($span);
}
/** @test */
public function shouldCloseReporter()
{
$this->childReporter1->expects($this->once())->method('close');
$this->childReporter2->expects($this->once())->method('close');
$this->reporter->close();
}
}
|