Completed
Push — master ( 2abbc3...c001e8 )
by Sam
04:41
created

AbstractManagerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 1
cbo 6
dl 0
loc 50
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 1
A getTestInstance() 0 6 1
1
<?php
2
3
namespace Jalle19\StatusManager\Test\Manager;
4
5
use Jalle19\StatusManager\Configuration\Configuration;
6
use Jalle19\StatusManager\Configuration\Instance;
7
use Monolog\Handler\NullHandler;
8
use Monolog\Logger;
9
use Psr\Log\LoggerInterface;
10
use Symfony\Component\EventDispatcher\EventDispatcher;
11
12
/**
13
 * Class AbstractManagerTest
14
 * @package   Jalle19\StatusManager\Test\Manager
15
 * @copyright Copyright &copy; Sam Stenvall 2016-
16
 * @license   https://www.gnu.org/licenses/gpl.html The GNU General Public License v2.0
17
 */
18
abstract class AbstractManagerTest extends \PHPUnit_Framework_TestCase
19
{
20
21
	/**
22
	 * @var Configuration
23
	 */
24
	protected $configuration;
25
26
	/**
27
	 * @var LoggerInterface
28
	 */
29
	protected $logger;
30
31
	/**
32
	 * @var EventDispatcher
33
	 */
34
	protected $eventDispatcher;
35
36
37
	/**
38
	 * AbstractManagerTest constructor.
39
	 */
40
	public function __construct()
41
	{
42
		parent::__construct();
43
44
		$this->eventDispatcher = new EventDispatcher();
45
46
		// Configure a null logger to suppress unwanted output
47
		$this->logger = new Logger('TestLogger');
48
		$this->logger->setHandlers([new NullHandler()]);
49
50
		// Configure a single test instance
51
		$this->configuration = new Configuration('/tmp', [
52
			new Instance('testInstance', 'example.com', 9981),
53
		]);
54
	}
55
56
57
	/**
58
	 * @return Instance
59
	 */
60
	protected function getTestInstance()
61
	{
62
		$instances = $this->configuration->getInstances();
63
64
		return $instances[0];
65
	}
66
67
}
68