Completed
Push — master ( da58d4...61a0f7 )
by Henry
06:34
created

RegistryTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 82
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testInit() 0 14 1
A testGetAndSet() 0 14 1
A testGetInvalid() 0 10 1
A testGetArray() 0 14 1
1
<?php
2
namespace Redaxscript\Tests;
3
4
/**
5
 * RegistryTest
6
 *
7
 * @since 2.1.0
8
 *
9
 * @package Redaxscript
10
 * @category Tests
11
 * @author Henry Ruhs
12
 * @author Gary Aylward
13
 *
14
 * @covers Redaxscript\Registry
15
 */
16
17
class RegistryTest extends TestCaseAbstract
18
{
19
	/**
20
	 * testInit
21
	 *
22
	 * @since 3.0.0
23
	 */
24
25
	public function testInit() : void
26
	{
27
		/* setup */
28
29
		$this->_registry->init();
30
31
		/* actual */
32
33
		$actual = $this->_registry;
34
35
		/* compare */
36
37
		$this->assertInstanceOf('Redaxscript\Registry', $actual);
38
	}
39
40
	/**
41
	 * testGetAndSet
42
	 *
43
	 * @since 2.1.0
44
	 */
45
46
	public function testGetAndSet() : void
47
	{
48
		/* setup */
49
50
		$this->_registry->set('testKey', 'testValue');
51
52
		/* actual */
53
54
		$actual = $this->_registry->get('testKey');
55
56
		/* compare */
57
58
		$this->assertEquals('testValue', $actual);
59
	}
60
61
	/**
62
	 * testGetArray
63
	 *
64
	 * @since 4.0.0
65
	 */
66
67
	public function testGetArray() : void
68
	{
69
		/* setup */
70
71
		$this->_registry->set('testKey', 'testValue');
72
73
		/* actual */
74
75
		$actualArray = $this->_registry->getArray();
76
77
		/* compare */
78
79
		$this->assertArrayHasKey('testKey', $actualArray);
80
	}
81
82
	/**
83
	 * testGetInvalid
84
	 *
85
	 * @since 2.1.0
86
	 */
87
88
	public function testGetInvalid() : void
89
	{
90
		/* actual */
91
92
		$actual = $this->_registry->get('invalidKey');
93
94
		/* compare */
95
96
		$this->assertNull($actual);
97
	}
98
}
99