1
|
|
|
<?php |
2
|
|
|
namespace Redaxscript\Tests\Console\Command; |
3
|
|
|
|
4
|
|
|
use Redaxscript\Console\Command; |
5
|
|
|
use Redaxscript\Tests\TestCaseAbstract; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* MigrateTest |
9
|
|
|
* |
10
|
|
|
* @since 4.4.0 |
11
|
|
|
* |
12
|
|
|
* @package Redaxscript |
13
|
|
|
* @category Tests |
14
|
|
|
* @author Henry Ruhs |
15
|
|
|
* |
16
|
|
|
* @covers Redaxscript\Console\Command\CommandAbstract |
17
|
|
|
* @covers Redaxscript\Console\Command\Migrate |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
class MigrateTest extends TestCaseAbstract |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* setUp |
24
|
|
|
* |
25
|
|
|
* @since 4.4.0 |
26
|
|
|
*/ |
27
|
|
|
|
28
|
|
|
public function setUp() : void |
29
|
|
|
{ |
30
|
|
|
parent::setUp(); |
31
|
|
|
$optionArray = $this->getOptionArray(); |
|
|
|
|
32
|
|
|
$installer = $this->installerFactory(); |
|
|
|
|
33
|
|
|
$installer->init(); |
34
|
|
|
$installer->rawCreate(); |
35
|
|
|
$installer->insertSettings($optionArray); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* tearDown |
40
|
|
|
* |
41
|
|
|
* @since 4.4.0 |
42
|
|
|
*/ |
43
|
|
|
|
44
|
|
|
public function tearDown() : void |
45
|
|
|
{ |
46
|
|
|
$this->dropDatabase(); |
|
|
|
|
47
|
|
|
$this->_request->setServer('argv', null); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* testNoArgument |
52
|
|
|
* |
53
|
|
|
* @since 4.4.0 |
54
|
|
|
*/ |
55
|
|
|
|
56
|
|
|
public function testNoArgument() : void |
57
|
|
|
{ |
58
|
|
|
/* setup */ |
59
|
|
|
|
60
|
|
|
$migrateCommand = new Command\Migrate($this->_registry, $this->_request, $this->_language, $this->_config); |
61
|
|
|
|
62
|
|
|
/* expect and actual */ |
63
|
|
|
|
64
|
|
|
$expect = $migrateCommand->getHelp(); |
65
|
|
|
$actual = $migrateCommand->run('cli'); |
66
|
|
|
|
67
|
|
|
/* compare */ |
68
|
|
|
|
69
|
|
|
$this->assertEquals($expect, $actual); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* testDatabase |
74
|
|
|
* |
75
|
|
|
* @since 4.4.0 |
76
|
|
|
*/ |
77
|
|
|
|
78
|
|
|
public function testDatabase() : void |
79
|
|
|
{ |
80
|
|
|
/* setup */ |
81
|
|
|
|
82
|
|
|
$this->_request->setServer('argv', |
83
|
|
|
[ |
84
|
|
|
'console.php', |
85
|
|
|
'migrate', |
86
|
|
|
'database' |
87
|
|
|
]); |
88
|
|
|
$migrateCommand = new Command\Migrate($this->_registry, $this->_request, $this->_language, $this->_config); |
89
|
|
|
|
90
|
|
|
/* expect and actual */ |
91
|
|
|
|
92
|
|
|
$expect = $migrateCommand->success(); |
93
|
|
|
$actual = $migrateCommand->run('cli'); |
94
|
|
|
|
95
|
|
|
/* compare */ |
96
|
|
|
|
97
|
|
|
$this->assertEquals($expect, $actual); |
98
|
|
|
} |
99
|
|
|
} |
100
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.