CronjobTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 58
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 9 1
A tearDown() 0 4 1
A testCronjob() 0 16 1
1
<?php
2
namespace Redaxscript\Tests\Bootstrap;
3
4
use Redaxscript\Bootstrap;
5
use Redaxscript\Tests\TestCaseAbstract;
6
7
/**
8
 * CronjobTest
9
 *
10
 * @since 3.1.0
11
 *
12
 * @package Redaxscript
13
 * @category Tests
14
 * @author Henry Ruhs
15
 *
16
 * @covers Redaxscript\Bootstrap\BootstrapAbstract
17
 * @covers Redaxscript\Bootstrap\Cronjob
18
 *
19
 * @runTestsInSeparateProcesses
20
 */
21
22
class CronjobTest extends TestCaseAbstract
23
{
24
	/**
25
	 * setUp
26
	 *
27
	 * @since 3.1.0
28
	 */
29
30
	public function setUp() : void
31
	{
32
		parent::setUp();
33
		$optionArray = $this->getOptionArray();
34
		$installer = $this->installerFactory();
35
		$installer->init();
36
		$installer->rawCreate();
37
		$installer->insertSettings($optionArray);
38
	}
39
40
	/**
41
	 * tearDown
42
	 *
43
	 * @since 3.1.0
44
	 */
45
46
	public function tearDown() : void
47
	{
48
		$this->dropDatabase();
49
	}
50
51
	/**
52
	 * testCronjob
53
	 *
54
	 * @since 3.1.0
55
	 *
56
	 * @param array $registryArray
57
	 * @param array $sessionArray
58
	 * @param bool $expect
59
	 *
60
	 * @dataProvider providerAutoloader
61
	 */
62
63
	public function testCronjob(array $registryArray = [], array $sessionArray = [], bool $expect = null) : void
64
	{
65
		/* setup */
66
67
		$this->_registry->init($registryArray);
68
		$this->_request->setSession('nextUpdate', $sessionArray['nextUpdate']);
69
		new Bootstrap\Cronjob($this->_registry, $this->_request);
70
71
		/* actual */
72
73
		$actual = $this->_registry->get('cronUpdate');
74
75
		/* compare */
76
77
		$this->assertEquals($expect, $actual);
78
	}
79
}
80