Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit 1a3a04b

Browse files
authored
Clean up test warnings (#164)
* Failing tests after setting error_reporting to E_ALL * Fix warnings
1 parent 9cfbfa6 commit 1a3a04b

File tree

6 files changed

+20
-8
lines changed

6 files changed

+20
-8
lines changed

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ RUN mkdir -p /build && \
2929

3030
COPY . /build/
3131

32+
COPY config/php.ini /usr/local/etc/php/
33+
3234
WORKDIR /build/ext
3335

3436
ENV TEST_PHP_ARGS="-q" \

config/php.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
error_reporting = E_ALL

src/Trace/Exporter/FileExporter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function export(array $spans)
7070
*/
7171
private function convertSpans(array $spans)
7272
{
73-
return array_map(function (SpanData $span) use ($traceId) {
73+
return array_map(function (SpanData $span) {
7474
return [
7575
'traceId' => $span->traceId(),
7676
'name' => $span->name(),

tests/unit/Trace/Exporter/LoggerExporterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ public function testLogsTrace()
6868
$this->logger->log('some-level', Argument::type('string'))->shouldBeCalled();
6969

7070
$exporter = new LoggerExporter($this->logger->reveal(), 'some-level');
71-
$this->assertTrue($exporter->export([$span->spanData]));
71+
$this->assertTrue($exporter->export([$span->spanData()]));
7272
}
7373
}

tests/unit/Trace/Exporter/StackdriverExporterTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,7 @@ public function testReportsVersionAttribute()
179179
->willReturn(true)->shouldBeCalled();
180180

181181
$span = new OCSpan([
182-
'traceId' => 'aaa',
183-
'attributes' => [
184-
$key => $value
185-
]
182+
'traceId' => 'aaa'
186183
]);
187184
$span->setStartTime();
188185
$span->setEndTime();

tests/unit/Trace/Exporter/ZipkinExporterTest.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,19 @@ public function testSpanKind($spanOpts, $kind)
9191
$this->assertEquals($kind, $spans[0]['kind']);
9292
}
9393

94+
public function testUnspecifiedSpanKind()
95+
{
96+
$span = new Span([
97+
'kind' => Span::KIND_UNSPECIFIED
98+
]);
99+
$span->setStartTime();
100+
$span->setEndTime();
101+
$exporter = new ZipkinExporter('myapp');
102+
$spans = $exporter->convertSpans([$span->spanData()]);
103+
104+
$this->assertArrayNotHasKey('kind', $spans[0]);
105+
}
106+
94107
public function spanOptionsForKind()
95108
{
96109
return [
@@ -99,8 +112,7 @@ public function spanOptionsForKind()
99112
[['name' => 'span3', 'timeEvents' => [new MessageEvent(MessageEvent::TYPE_RECEIVED, '')]], 'SERVER'],
100113
[['name' => 'span4', 'timeEvents' => [new MessageEvent(MessageEvent::TYPE_SENT, '')]], 'CLIENT'],
101114
[['kind' => Span::KIND_SERVER], 'SERVER'],
102-
[['kind' => Span::KIND_CLIENT], 'CLIENT'],
103-
[['kind' => Span::KIND_UNSPECIFIED], null]
115+
[['kind' => Span::KIND_CLIENT], 'CLIENT']
104116
];
105117
}
106118

0 commit comments

Comments
 (0)