-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea86fe1
commit f22ffa0
Showing
8 changed files
with
204 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
tests/Unit/SDK/Logs/Exporter/InMemoryExporterFactoryTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenTelemetry\Tests\Unit\SDK\Logs\Exporter; | ||
|
||
use OpenTelemetry\SDK\Logs\Exporter\InMemoryExporterFactory; | ||
use OpenTelemetry\SDK\Logs\LogRecordExporterInterface; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @covers \OpenTelemetry\SDK\Logs\Exporter\InMemoryExporterFactory | ||
*/ | ||
class InMemoryExporterFactoryTest extends TestCase | ||
{ | ||
public function test_create(): void | ||
{ | ||
$factory = new InMemoryExporterFactory(); | ||
$this->assertInstanceOf(LogRecordExporterInterface::class, $factory->create()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenTelemetry\Tests\Unit\SDK\Logs\Exporter; | ||
|
||
use OpenTelemetry\API\Logs\LogRecord; | ||
use OpenTelemetry\SDK\Common\Instrumentation\InstrumentationScopeInterface; | ||
use OpenTelemetry\SDK\Logs\Exporter\InMemoryExporter; | ||
use OpenTelemetry\SDK\Logs\LoggerSharedState; | ||
use OpenTelemetry\SDK\Logs\ReadableLogRecord; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @covers \OpenTelemetry\SDK\Logs\Exporter\InMemoryExporter | ||
* @psalm-suppress UndefinedInterfaceMethod | ||
*/ | ||
class InMemoryExporterTest extends TestCase | ||
{ | ||
public function test_export(): void | ||
{ | ||
$exporter = new InMemoryExporter(); | ||
$batch = [ | ||
(new ReadableLogRecord( | ||
$this->createMock(InstrumentationScopeInterface::class), | ||
$this->createMock(LoggerSharedState::class), | ||
(new LogRecord('foo')), | ||
)), | ||
]; | ||
|
||
$this->assertTrue($exporter->export($batch)->await()); | ||
} | ||
|
||
public function test_force_flush(): void | ||
{ | ||
$exporter = new InMemoryExporter(); | ||
$this->assertTrue($exporter->forceFlush()); | ||
} | ||
|
||
public function test_shutdown(): void | ||
{ | ||
$exporter = new InMemoryExporter(); | ||
$this->assertTrue($exporter->shutdown()); | ||
} | ||
|
||
public function test_storage(): void | ||
{ | ||
$exporter = new InMemoryExporter(); | ||
$this->assertCount(0, $exporter->getStorage()); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
tests/Unit/SDK/Metrics/MetricExporter/InMemoryExporterFactoryTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenTelemetry\Tests\Unit\SDK\Metrics\MetricExporter; | ||
|
||
use OpenTelemetry\SDK\Metrics\MetricExporter\InMemoryExporterFactory; | ||
use OpenTelemetry\SDK\Metrics\MetricExporterInterface; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @covers \OpenTelemetry\SDK\Metrics\MetricExporter\InMemoryExporterFactory | ||
*/ | ||
class InMemoryExporterFactoryTest extends TestCase | ||
{ | ||
public function test_create(): void | ||
{ | ||
$exporter = (new InMemoryExporterFactory())->create(); | ||
$this->assertInstanceOf(MetricExporterInterface::class, $exporter); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
tests/Unit/SDK/Metrics/MetricExporter/NoopMetricExporterFactoryTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenTelemetry\Tests\Unit\SDK\Metrics\MetricExporter; | ||
|
||
use OpenTelemetry\SDK\Metrics\MetricExporter\NoopMetricExporterFactory; | ||
use OpenTelemetry\SDK\Metrics\MetricExporterInterface; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @covers \OpenTelemetry\SDK\Metrics\MetricExporter\NoopMetricExporterFactory | ||
*/ | ||
class NoopMetricExporterFactoryTest extends TestCase | ||
{ | ||
public function test_create(): void | ||
{ | ||
$exporter = (new NoopMetricExporterFactory())->create(); | ||
$this->assertInstanceOf(MetricExporterInterface::class, $exporter); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
tests/Unit/SDK/Trace/SpanExporter/ConsoleSpanExporterFactoryTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenTelemetry\Tests\Unit\SDK\Trace\SpanExporter; | ||
|
||
use OpenTelemetry\SDK\Trace\SpanExporter\ConsoleSpanExporterFactory; | ||
use OpenTelemetry\SDK\Trace\SpanExporterInterface; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @covers \OpenTelemetry\SDK\Trace\SpanExporter\ConsoleSpanExporterFactory | ||
*/ | ||
class ConsoleSpanExporterFactoryTest extends TestCase | ||
{ | ||
public function test_create(): void | ||
{ | ||
$exporter = (new ConsoleSpanExporterFactory())->create(); | ||
$this->assertInstanceOf(SpanExporterInterface::class, $exporter); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
tests/Unit/SDK/Trace/SpanExporter/InMemorySpanExporterFactoryTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenTelemetry\Tests\Unit\SDK\Trace\SpanExporter; | ||
|
||
use OpenTelemetry\SDK\Trace\SpanExporter\InMemorySpanExporterFactory; | ||
use OpenTelemetry\SDK\Trace\SpanExporterInterface; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @covers \OpenTelemetry\SDK\Trace\SpanExporter\InMemorySpanExporterFactory | ||
*/ | ||
class InMemorySpanExporterFactoryTest extends TestCase | ||
{ | ||
public function test_create(): void | ||
{ | ||
$exporter = (new InMemorySpanExporterFactory())->create(); | ||
$this->assertInstanceOf(SpanExporterInterface::class, $exporter); | ||
} | ||
} |