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\Tests\TestCaseAbstract; |
||
6 | use org\bovigo\vfs\vfsStream as Stream; |
||
7 | |||
8 | /** |
||
9 | * RestoreTest |
||
10 | * |
||
11 | * @since 3.0.0 |
||
12 | * |
||
13 | * @package Redaxscript |
||
14 | * @category Tests |
||
15 | * @author Henry Ruhs |
||
16 | * |
||
17 | * @requires OS Linux |
||
18 | */ |
||
19 | |||
20 | class RestoreTest extends TestCaseAbstract |
||
21 | { |
||
22 | /** |
||
23 | * setUp |
||
24 | * |
||
25 | * @since 3.0.0 |
||
26 | */ |
||
27 | |||
28 | public function setUp() |
||
29 | { |
||
30 | parent::setUp(); |
||
31 | Stream::setup('root', 0777, $this->getProvider('tests/provider/Console/console_setup.json')); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * tearDown |
||
36 | * |
||
37 | * @since 3.0.0 |
||
38 | */ |
||
39 | |||
40 | public function tearDown() |
||
41 | { |
||
42 | $this->_request->setServer('argv', null); |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * testNoArgument |
||
47 | * |
||
48 | * @since 3.0.0 |
||
49 | */ |
||
50 | |||
51 | public function testNoArgument() |
||
52 | { |
||
53 | /* setup */ |
||
54 | |||
55 | $restoreCommand = new Command\Restore($this->_registry, $this->_request, $this->_language, $this->_config); |
||
56 | |||
57 | /* expect and actual */ |
||
58 | |||
59 | $expect = $restoreCommand->getHelp(); |
||
60 | $actual = $restoreCommand->run('cli'); |
||
61 | |||
62 | /* compare */ |
||
63 | |||
64 | $this->assertEquals($expect, $actual); |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * testDatabase |
||
69 | * |
||
70 | * @since 3.0.0 |
||
71 | */ |
||
72 | |||
73 | public function testDatabase() |
||
74 | { |
||
75 | /* setup */ |
||
76 | |||
77 | $this->_request->setServer('argv', |
||
78 | [ |
||
0 ignored issues
–
show
|
|||
79 | 'console.php', |
||
80 | 'restore', |
||
81 | 'database', |
||
82 | '--directory', |
||
83 | Stream::url('root/build'), |
||
84 | '--file', |
||
85 | 'test.sql' |
||
86 | ]); |
||
87 | $restoreCommand = new Command\Restore($this->_registry, $this->_request, $this->_language, $this->_config); |
||
88 | |||
89 | /* actual */ |
||
90 | |||
91 | $actual = $restoreCommand->run('cli'); |
||
92 | |||
93 | /* compare */ |
||
94 | |||
95 | $this->assertTrue($actual); |
||
96 | } |
||
97 | |||
98 | /** |
||
99 | * testDatabaseInvalid |
||
100 | * |
||
101 | * @since 3.0.0 |
||
102 | */ |
||
103 | |||
104 | public function testDatabaseInvalid() |
||
105 | { |
||
106 | /* setup */ |
||
107 | |||
108 | $this->_request->setServer('argv', |
||
109 | [ |
||
110 | 'console.php', |
||
111 | 'restore', |
||
112 | 'database', |
||
113 | '--no-interaction' |
||
114 | ]); |
||
115 | $restoreCommand = new Command\Restore($this->_registry, $this->_request, $this->_language, $this->_config); |
||
116 | |||
117 | /* actual */ |
||
118 | |||
119 | $actual = $restoreCommand->run('cli'); |
||
120 | |||
121 | /* compare */ |
||
122 | |||
123 | $this->assertFalse($actual); |
||
124 | } |
||
125 | } |
||
126 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: