Skip to content

Commit

Permalink
factory test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
brettmc committed Jan 13, 2025
1 parent b7af73d commit a8fc516
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/Unit/Contrib/Otlp/LogsExporterFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,16 @@ public static function configProvider(): array
],
];
}

public function test_type(): void
{
$factory = new LogsExporterFactory();
$this->assertSame('otlp', $factory->type());
}

public function test_priority(): void
{
$factory = new LogsExporterFactory();
$this->assertSame(0, $factory->priority());
}
}
12 changes: 12 additions & 0 deletions tests/Unit/Contrib/Otlp/MetricExporterFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,16 @@ public static function configProvider(): array
],
];
}

public function test_type(): void
{
$factory = new MetricExporterFactory();
$this->assertSame('otlp', $factory->type());
}

public function test_priority(): void
{
$factory = new MetricExporterFactory();
$this->assertSame(0, $factory->priority());
}
}
12 changes: 12 additions & 0 deletions tests/Unit/Contrib/Otlp/SpanExporterFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,16 @@ public static function configProvider(): array
],
];
}

public function test_type(): void
{
$factory = new SpanExporterFactory();
$this->assertSame('otlp', $factory->type());
}

public function test_priority(): void
{
$factory = new SpanExporterFactory();
$this->assertSame(0, $factory->priority());
}
}
12 changes: 12 additions & 0 deletions tests/Unit/SDK/Logs/Exporter/ConsoleExporterFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,16 @@ public function test_create(): void

$this->assertInstanceOf(ConsoleExporter::class, $factory->create());
}

public function test_type(): void
{
$factory = new ConsoleExporterFactory();
$this->assertSame('console', $factory->type());
}

public function test_priority(): void
{
$factory = new ConsoleExporterFactory();
$this->assertSame(0, $factory->priority());
}
}
11 changes: 11 additions & 0 deletions tests/Unit/SDK/Logs/Exporter/InMemoryExporterFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,15 @@ public function test_create(): void
$factory = new InMemoryExporterFactory();
$this->assertInstanceOf(LogRecordExporterInterface::class, $factory->create());
}
public function test_type(): void
{
$factory = new InMemoryExporterFactory();
$this->assertSame('memory', $factory->type());
}

public function test_priority(): void
{
$factory = new InMemoryExporterFactory();
$this->assertSame(0, $factory->priority());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,16 @@ public function test_create(): void
$exporter = (new ConsoleMetricExporterFactory())->create();
$this->assertInstanceOf(MetricExporterInterface::class, $exporter);
}

public function test_type(): void
{
$factory = new ConsoleMetricExporterFactory();
$this->assertSame('console', $factory->type());
}

public function test_priority(): void
{
$factory = new ConsoleMetricExporterFactory();
$this->assertSame(0, $factory->priority());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,16 @@ public function test_create(): void
$exporter = (new InMemoryExporterFactory())->create();
$this->assertInstanceOf(MetricExporterInterface::class, $exporter);
}

public function test_type(): void
{
$factory = new InMemoryExporterFactory();
$this->assertSame('memory', $factory->type());
}

public function test_priority(): void
{
$factory = new InMemoryExporterFactory();
$this->assertSame(0, $factory->priority());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,16 @@ public function test_create(): void
$exporter = (new NoopMetricExporterFactory())->create();
$this->assertInstanceOf(MetricExporterInterface::class, $exporter);
}

public function test_type(): void
{
$factory = new NoopMetricExporterFactory();
$this->assertSame('none', $factory->type());
}

public function test_priority(): void
{
$factory = new NoopMetricExporterFactory();
$this->assertSame(0, $factory->priority());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,16 @@ public function test_create(): void
$exporter = (new ConsoleSpanExporterFactory())->create();
$this->assertInstanceOf(SpanExporterInterface::class, $exporter);
}

public function test_type(): void
{
$factory = new ConsoleSpanExporterFactory();
$this->assertSame('console', $factory->type());
}

public function test_priority(): void
{
$factory = new ConsoleSpanExporterFactory();
$this->assertSame(0, $factory->priority());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,16 @@ public function test_create(): void
$exporter = (new InMemorySpanExporterFactory())->create();
$this->assertInstanceOf(SpanExporterInterface::class, $exporter);
}

public function test_type(): void
{
$factory = new InMemorySpanExporterFactory();
$this->assertSame('memory', $factory->type());
}

public function test_priority(): void
{
$factory = new InMemorySpanExporterFactory();
$this->assertSame(0, $factory->priority());
}
}

0 comments on commit a8fc516

Please sign in to comment.