MetadataTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 84
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetAndSetDashboard() 0 30 1
A testGetAndSetNotification() 0 38 1
1
<?php
2
namespace Redaxscript\Tests\Module;
3
4
use Redaxscript\Module;
5
use Redaxscript\Tests\TestCaseAbstract;
6
7
/**
8
 * MetadataTest
9
 *
10
 * @since 4.1.0
11
 *
12
 * @package Redaxscript
13
 * @category Tests
14
 * @author Henry Ruhs
15
 *
16
 * @covers Redaxscript\Module\Metadata
17
 *
18
 * @runTestsInSeparateProcesses
19
 */
20
21
class MetadataTest extends TestCaseAbstract
22
{
23
	/**
24
	 * testGetAndSetDashboard
25
	 *
26
	 * @since 4.1.0
27
	 */
28
29
	public function testGetAndSetDashboard() : void
30
	{
31
		/* setup */
32
33
		$module = new Module\Metadata($this->_registry, $this->_request, $this->_language, $this->_config);
34
		$module->init(
35
		[
36
			'name' => 'Test Dummy',
37
			'alias' => 'TestDummy'
38
		]);
39
		$module->setDashboard('Test Dummy', 2);
40
41
		/* expect and actual */
42
43
		$expectArray =
44
		[
45
			'Test Dummy' =>
46
			[
47
				[
48
					'column' => 2,
49
					'content' => 'Test Dummy'
50
				]
51
			]
52
		];
53
		$actualArray = $module->getDashboardArray();
54
55
		/* compare */
56
57
		$this->assertEquals($expectArray, $actualArray);
58
	}
59
60
	/**
61
	 * testGetAndSetNotification
62
	 *
63
	 * @since 3.0.0
64
	 */
65
66
	public function testGetAndSetNotification() : void
67
	{
68
		/* setup */
69
70
		$module = new Module\Metadata($this->_registry, $this->_request, $this->_language, $this->_config);
71
		$module->init(
72
		[
73
			'name' => 'Test Dummy',
74
			'alias' => 'TestDummy'
75
		]);
76
		$module->setNotification('success', 'Success');
77
		$module->setNotification('error', 'Error');
78
79
		/* expect and actual */
80
81
		$expectArray =
82
		[
83
			'success' =>
84
			[
85
				'Test Dummy' =>
86
				[
87
					'Success'
88
				]
89
			],
90
			'error' =>
91
			[
92
				'Test Dummy' =>
93
				[
94
					'Error'
95
				]
96
			]
97
		];
98
		$actualArray = $module->getNotificationArray();
99
100
		/* compare */
101
102
		$this->assertEquals($expectArray, $actualArray);
103
	}
104
}
105