These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | namespace Redaxscript\Tests\Console\Command; |
||
3 | |||
4 | use Redaxscript\Console\Command; |
||
5 | use Redaxscript\Dater; |
||
6 | use Redaxscript\Tests\TestCaseAbstract; |
||
7 | |||
8 | /** |
||
9 | * RestoreTest |
||
10 | * |
||
11 | * @since 3.0.0 |
||
12 | * |
||
13 | * @package Redaxscript |
||
14 | * @category Tests |
||
15 | * @author Henry Ruhs |
||
16 | * |
||
17 | * @covers Redaxscript\Console\Command\CommandAbstract |
||
18 | * @covers Redaxscript\Console\Command\Restore |
||
19 | * |
||
20 | * @requires OS Linux |
||
21 | */ |
||
22 | |||
23 | class RestoreTest extends TestCaseAbstract |
||
24 | { |
||
25 | /** |
||
26 | * setUp |
||
27 | * |
||
28 | * @since 3.0.0 |
||
29 | */ |
||
30 | |||
31 | public function setUp() : void |
||
32 | { |
||
33 | parent::setUp(); |
||
34 | $optionArray = $this->getOptionArray(); |
||
0 ignored issues
–
show
|
|||
35 | $installer = $this->installerFactory(); |
||
0 ignored issues
–
show
The method
installerFactory() does not seem to exist on object<Redaxscript\Tests...le\Command\RestoreTest> .
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.
Loading history...
|
|||
36 | $installer->init(); |
||
37 | $installer->rawCreate(); |
||
38 | $installer->insertSettings($optionArray); |
||
39 | $installer->rawMigrate(); |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * tearDown |
||
44 | * |
||
45 | * @since 3.0.0 |
||
46 | */ |
||
47 | |||
48 | public function tearDown() : void |
||
49 | { |
||
50 | $this->dropDatabase(); |
||
51 | $this->_request->setServer('argv', null); |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * testNoArgument |
||
56 | * |
||
57 | * @since 3.0.0 |
||
58 | */ |
||
59 | |||
60 | public function testNoArgument() : void |
||
61 | { |
||
62 | /* setup */ |
||
63 | |||
64 | $restoreCommand = new Command\Restore($this->_registry, $this->_request, $this->_language, $this->_config); |
||
65 | |||
66 | /* expect and actual */ |
||
67 | |||
68 | $expect = $restoreCommand->getHelp(); |
||
69 | $actual = $restoreCommand->run('cli'); |
||
70 | |||
71 | /* compare */ |
||
72 | |||
73 | $this->assertEquals($expect, $actual); |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * testDatabase |
||
78 | * |
||
79 | * @since 3.0.0 |
||
80 | */ |
||
81 | |||
82 | public function testDatabase() : void |
||
83 | { |
||
84 | /* setup */ |
||
85 | |||
86 | $dater = new Dater(); |
||
87 | $dater->init(); |
||
88 | $dbType = $this->_config->get('dbType'); |
||
89 | $dbName = $this->_config->get('dbName'); |
||
90 | $file = $dbName ? $dbName . '_' . $dater->formatDate() . '_' . $dater->formatTime() . '.' . $dbType : $dater->formatDate() . '_' . $dater->formatTime() . '.' . $dbType; |
||
91 | $this->_request->setServer('argv', |
||
92 | [ |
||
93 | 'console.php', |
||
94 | 'restore', |
||
95 | 'database', |
||
96 | '--directory', |
||
97 | 'build', |
||
98 | '--file', |
||
99 | $file |
||
100 | ]); |
||
101 | $restoreCommand = new Command\Restore($this->_registry, $this->_request, $this->_language, $this->_config); |
||
102 | |||
103 | /* expect and actual */ |
||
104 | |||
105 | $expect = $restoreCommand->success(); |
||
106 | $actual = $restoreCommand->run('cli'); |
||
107 | |||
108 | /* compare */ |
||
109 | |||
110 | $this->assertEquals($expect, $actual); |
||
111 | } |
||
112 | |||
113 | /** |
||
114 | * testDatabaseInvalid |
||
115 | * |
||
116 | * @since 3.0.0 |
||
117 | */ |
||
118 | |||
119 | public function testDatabaseInvalid() : void |
||
120 | { |
||
121 | /* setup */ |
||
122 | |||
123 | $this->_request->setServer('argv', |
||
124 | [ |
||
125 | 'console.php', |
||
126 | 'restore', |
||
127 | 'database', |
||
128 | '--no-interaction' |
||
129 | ]); |
||
130 | $restoreCommand = new Command\Restore($this->_registry, $this->_request, $this->_language, $this->_config); |
||
131 | |||
132 | /* expect and actual */ |
||
133 | |||
134 | $expect = $restoreCommand->error(); |
||
135 | $actual = $restoreCommand->run('cli'); |
||
136 | |||
137 | /* compare */ |
||
138 | |||
139 | $this->assertEquals($expect, $actual); |
||
140 | } |
||
141 | } |
||
142 |
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.