Skip to content

Commit

Permalink
Merge pull request #69 from jcchavezs/fixes_reporter_default_values
Browse files Browse the repository at this point in the history
Fixes default values for reporter.
  • Loading branch information
jcchavezs authored Mar 7, 2018
2 parents c5fed92 + a748854 commit b9fe432
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Zipkin/Reporters/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(
) {
$this->clientFactory = $requesterFactory ?: CurlFactory::create();
$this->options = array_merge(self::DEFAULT_OPTIONS, $options);
$this->reportMetrics = $reporterMetrics;
$this->reportMetrics = $reporterMetrics ?: new NoopMetrics();
}

/**
Expand Down
4 changes: 4 additions & 0 deletions src/Zipkin/Reporters/Http/CurlFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

final class CurlFactory implements ClientFactory
{
private function __construct()
{
}

/**
* @return CurlFactory
* @throws \BadFunctionCallException if the curl extension is not installed.
Expand Down
6 changes: 6 additions & 0 deletions tests/Unit/Reporters/HttpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ final class HttpTest extends PHPUnit_Framework_TestCase
const PAYLOAD = '[{"id":"%s","name":null,"traceId":"%s","parentId":null,'
. '"timestamp":null,"duration":null,"debug":false,"localEndpoint":{"serviceName":""}}]';

public function testCreateHttpReporterWithDefaultDependencies()
{
$httpReporter = new Http();
$this->assertInstanceOf(Http::class, $httpReporter);
}

public function testHttpReporterSuccess()
{
$context = TraceContext::createAsRoot();
Expand Down

0 comments on commit b9fe432

Please sign in to comment.