-
Notifications
You must be signed in to change notification settings - Fork 439
/
Copy pathGenericStatsStorageFactoryTest.php
42 lines (32 loc) · 1.22 KB
/
GenericStatsStorageFactoryTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace Enqueue\Monitoring\Tests;
use Enqueue\Monitoring\GenericStatsStorageFactory;
use Enqueue\Monitoring\InfluxDbStorage;
use Enqueue\Monitoring\StatsStorageFactory;
use Enqueue\Monitoring\WampStorage;
use Enqueue\Test\ClassExtensionTrait;
use PHPUnit\Framework\TestCase;
class GenericStatsStorageFactoryTest extends TestCase
{
use ClassExtensionTrait;
public function testShouldImplementStatsStorageFactoryInterface()
{
$this->assertClassImplements(StatsStorageFactory::class, GenericStatsStorageFactory::class);
}
public function testShouldCreateInfluxDbStorage()
{
$storage = (new GenericStatsStorageFactory())->create('influxdb:');
$this->assertInstanceOf(InfluxDbStorage::class, $storage);
}
public function testShouldCreateWampStorage()
{
$storage = (new GenericStatsStorageFactory())->create('wamp:');
$this->assertInstanceOf(WampStorage::class, $storage);
}
public function testShouldThrowIfStorageIsNotSupported()
{
$this->expectException(\LogicException::class);
$this->expectExceptionMessage('Unsupported stats storage: "unsupported:"');
(new GenericStatsStorageFactory())->create('unsupported:');
}
}