add unit tests
This commit is contained in:
parent
00cb369d0b
commit
9c2453f0e4
8 changed files with 508 additions and 22 deletions
43
tests/StorageAdapterFactoryTest.php
Normal file
43
tests/StorageAdapterFactoryTest.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace Tests;
|
||||
|
||||
use Mockery;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prometheus\Storage\APC;
|
||||
use Prometheus\Storage\InMemory;
|
||||
use Prometheus\Storage\Redis;
|
||||
use Superbalist\LaravelPrometheusExporter\StorageAdapterFactory;
|
||||
|
||||
class StorageAdapterFactoryTest extends TestCase
|
||||
{
|
||||
public function testMakeMemoryAdapter()
|
||||
{
|
||||
$factory = new StorageAdapterFactory();
|
||||
$adapter = $factory->make('memory');
|
||||
$this->assertInstanceOf(InMemory::class, $adapter);
|
||||
}
|
||||
|
||||
public function testMakeApcAdapter()
|
||||
{
|
||||
$factory = new StorageAdapterFactory();
|
||||
$adapter = $factory->make('apc');
|
||||
$this->assertInstanceOf(APC::class, $adapter);
|
||||
}
|
||||
|
||||
public function testMakeRedisAdapter()
|
||||
{
|
||||
$factory = new StorageAdapterFactory();
|
||||
$adapter = $factory->make('redis');
|
||||
$this->assertInstanceOf(Redis::class, $adapter);
|
||||
}
|
||||
|
||||
public function testMakeInvalidAdapter()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
$this->expectExceptionMessage('The driver [moo] is not supported.');
|
||||
|
||||
$factory = new StorageAdapterFactory();
|
||||
$factory->make('moo');
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue