blob: 0b85f06d093bdfcffe2c0bc4656619278b2c92ce (
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
|
<?php
namespace Jaeger\Tests\Reporter;
use Jaeger\Reporter\RemoteReporter;
use Jaeger\Sender\UdpSender;
use Jaeger\Span;
use PHPUnit\Framework\TestCase;
class RemoteReporterTest extends TestCase
{
/** @var RemoteReporter */
private $reporter;
/** @var UdpSender|\PHPUnit\Framework\MockObject\MockObject */
private $transport;
/**
* {@inheritdoc}
*/
public function setUp(): void
{
$this->transport = $this->createMock(UdpSender::class);
$this->reporter = new RemoteReporter($this->transport);
}
/** @test */
public function shouldReportSpan()
{
/** @var Span|\PHPUnit\Framework\MockObject\MockObject $span */
$span = $this->createMock(Span::class);
$this->transport->expects($this->once())->method('append')->with($span);
$this->reporter->reportSpan($span);
}
/** @test */
public function shouldCloseReporter()
{
$this->transport->expects($this->once())->method('flush');
$this->transport->expects($this->once())->method('close');
$this->reporter->close();
}
}
|