StandardTest   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 7
eloc 17
c 2
b 0
f 0
dl 0
loc 53
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testClone() 0 4 1
A testGetDatabaseConfig() 0 4 1
A testGetException() 0 6 1
A testGet() 0 4 1
A tearDown() 0 3 1
A testGetFallback() 0 4 1
1
<?php
2
3
namespace Aimeos\Base\MQueue\Manager;
4
5
6
class StandardTest extends \PHPUnit\Framework\TestCase
7
{
8
	private $config;
9
	private $object;
10
11
12
	protected function setUp() : void
13
	{
14
		$this->config = \TestHelper::getConfig();
15
		$this->object = new \Aimeos\Base\MQueue\Manager\Standard( \TestHelper::getConfig()->get( 'resource', [] ) );
16
	}
17
18
19
	protected function tearDown() : void
20
	{
21
		unset( $this->object );
22
	}
23
24
25
	public function testClone()
26
	{
27
		$this->config->set( 'resource/mq-email', array( 'adapter' => 'None' ) );
28
		$this->assertInstanceof( 'Aimeos\Base\MQueue\Manager\Iface', clone $this->object );
29
	}
30
31
32
	public function testGet()
33
	{
34
		$this->config->set( 'resource/mq-email', array( 'adapter' => 'None' ) );
35
		$this->assertInstanceof( 'Aimeos\Base\MQueue\Iface', $this->object->get( 'mq-email' ) );
36
	}
37
38
39
	public function testGetFallback()
40
	{
41
		$this->config->set( 'resource/mq', array( 'adapter' => 'None' ) );
42
		$this->assertInstanceof( 'Aimeos\Base\MQueue\Iface', $this->object->get( 'mq-email' ) );
43
	}
44
45
46
	public function testGetException()
47
	{
48
		$object = new \Aimeos\Base\MQueue\Manager\Standard( [] );
49
50
		$this->expectException( \Aimeos\Base\MQueue\Exception::class );
51
		$object->get( 'xx' );
52
	}
53
54
55
	public function testGetDatabaseConfig()
56
	{
57
		$this->config->set( 'resource/mq-email', array( 'adapter' => 'Standard', 'db' => 'db' ) );
58
		$this->assertInstanceof( 'Aimeos\Base\MQueue\Iface', $this->object->get( 'mq-email' ) );
59
	}
60
}
61