1
|
|
|
<?php |
2
|
|
|
namespace Redaxscript\Tests\Console\Command; |
3
|
|
|
|
4
|
|
|
use Redaxscript\Console\Command; |
5
|
|
|
use Redaxscript\Tests\TestCaseAbstract; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* StatusTest |
9
|
|
|
* |
10
|
|
|
* @since 3.0.0 |
11
|
|
|
* |
12
|
|
|
* @package Redaxscript |
13
|
|
|
* @category Tests |
14
|
|
|
* @author Henry Ruhs |
15
|
|
|
* |
16
|
|
|
* @covers Redaxscript\Console\Command\CommandAbstract |
17
|
|
|
* @covers Redaxscript\Console\Command\Status |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
class StatusTest extends TestCaseAbstract |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* tearDown |
24
|
|
|
* |
25
|
|
|
* @since 3.0.0 |
26
|
|
|
*/ |
27
|
|
|
|
28
|
|
|
public function tearDown() : void |
29
|
|
|
{ |
30
|
|
|
$this->_request->setServer('argv', null); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* testNoArgument |
35
|
|
|
* |
36
|
|
|
* @since 3.0.0 |
37
|
|
|
*/ |
38
|
|
|
|
39
|
|
|
public function testNoArgument() : void |
40
|
|
|
{ |
41
|
|
|
/* setup */ |
42
|
|
|
|
43
|
|
|
$statusCommand = new Command\Status($this->_registry, $this->_request, $this->_language, $this->_config); |
44
|
|
|
|
45
|
|
|
/* expect and actual */ |
46
|
|
|
|
47
|
|
|
$expect = $statusCommand->getHelp(); |
48
|
|
|
$actual = $statusCommand->run('cli'); |
49
|
|
|
|
50
|
|
|
/* compare */ |
51
|
|
|
|
52
|
|
|
$this->assertEquals($expect, $actual); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* testDatabase |
57
|
|
|
* |
58
|
|
|
* @since 3.0.0 |
59
|
|
|
*/ |
60
|
|
|
|
61
|
|
|
public function testDatabase() : void |
62
|
|
|
{ |
63
|
|
|
/* setup */ |
64
|
|
|
|
65
|
|
|
$this->_request->setServer('argv', |
66
|
|
|
[ |
67
|
|
|
'console.php', |
68
|
|
|
'status', |
69
|
|
|
'database' |
70
|
|
|
]); |
71
|
|
|
$statusCommand = new Command\Status($this->_registry, $this->_request, $this->_language, $this->_config); |
72
|
|
|
|
73
|
|
|
/* actual */ |
74
|
|
|
|
75
|
|
|
$actual = $statusCommand->run('cli'); |
76
|
|
|
|
77
|
|
|
/* compare */ |
78
|
|
|
|
79
|
|
|
$this->assertIsString($actual); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* testSystem |
84
|
|
|
* |
85
|
|
|
* @since 3.0.0 |
86
|
|
|
*/ |
87
|
|
|
|
88
|
|
|
public function testSystem() : void |
89
|
|
|
{ |
90
|
|
|
/* setup */ |
91
|
|
|
|
92
|
|
|
$this->_registry->set('driverArray', |
93
|
|
|
[ |
94
|
|
|
'mssql', |
95
|
|
|
'mysql', |
96
|
|
|
'pgsql', |
97
|
|
|
'sqlite' |
98
|
|
|
]); |
99
|
|
|
$this->_registry->set('moduleArray', |
100
|
|
|
[ |
101
|
|
|
'mod_deflate', |
102
|
|
|
'mod_headers', |
103
|
|
|
'mod_rewrite' |
104
|
|
|
]); |
105
|
|
|
$this->_request->setServer('argv', |
106
|
|
|
[ |
107
|
|
|
'console.php', |
108
|
|
|
'status', |
109
|
|
|
'system' |
110
|
|
|
]); |
111
|
|
|
$statusCommand = new Command\Status($this->_registry, $this->_request, $this->_language, $this->_config); |
112
|
|
|
|
113
|
|
|
/* actual */ |
114
|
|
|
|
115
|
|
|
$actual = $statusCommand->run('cli'); |
116
|
|
|
|
117
|
|
|
/* compare */ |
118
|
|
|
|
119
|
|
|
$this->assertIsString($actual); |
120
|
|
|
} |
121
|
|
|
} |
122
|
|
|
|