These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | use AspectMock\Test as test; |
||
0 ignored issues
–
show
|
|||
3 | |||
4 | use Robo\Traits\Common\AdjustQuotes; |
||
5 | |||
6 | class ComposerTest extends \Codeception\TestCase\Test |
||
7 | { |
||
8 | use AdjustQuotes; |
||
9 | |||
10 | protected $container; |
||
11 | |||
12 | /** |
||
13 | * @var \AspectMock\Proxy\ClassProxy |
||
14 | */ |
||
15 | protected $baseComposer; |
||
16 | |||
17 | protected function _before() |
||
18 | { |
||
19 | $this->baseComposer = test::double('Robo\Task\Composer\Base', [ |
||
0 ignored issues
–
show
It seems like
\AspectMock\Test::double...\Psr\Log\NullLogger())) can also be of type object<AspectMock\Proxy\InstanceProxy> . However, the property $baseComposer is declared as type object<AspectMock\Proxy\ClassProxy> . Maybe add an additional type check?
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly. For example, imagine you have a variable Either this assignment is in error or a type check should be added for that assignment. class Id
{
public $id;
public function __construct($id)
{
$this->id = $id;
}
}
class Account
{
/** @var Id $id */
public $id;
}
$account_id = false;
if (starsAreRight()) {
$account_id = new Id(42);
}
$account = new Account();
if ($account instanceof Id)
{
$account->id = $account_id;
}
Loading history...
|
|||
20 | 'output' => new \Symfony\Component\Console\Output\NullOutput(), |
||
21 | 'logger' => new \Psr\Log\NullLogger(), |
||
22 | ]); |
||
23 | } |
||
24 | // tests |
||
25 | View Code Duplication | public function testComposerInstall() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
26 | { |
||
27 | $composer = test::double('Robo\Task\Composer\Install', ['executeCommand' => null, 'getConfig' => new \Robo\Config(), 'logger' => new \Psr\Log\NullLogger()]); |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
28 | |||
29 | (new \Robo\Task\Composer\Install('composer'))->run(); |
||
30 | $composer->verifyInvoked('executeCommand', ['composer install --no-interaction']); |
||
31 | |||
32 | (new \Robo\Task\Composer\Install('composer')) |
||
33 | ->preferSource() |
||
34 | ->run(); |
||
35 | $composer->verifyInvoked('executeCommand', ['composer install --prefer-source --no-interaction']); |
||
36 | |||
37 | (new \Robo\Task\Composer\Install('composer')) |
||
38 | ->optimizeAutoloader() |
||
39 | ->run(); |
||
40 | $composer->verifyInvoked('executeCommand', ['composer install --optimize-autoloader --no-interaction']); |
||
41 | } |
||
42 | |||
43 | public function testComposerInstallAnsi() |
||
44 | { |
||
45 | $config = new \Robo\Config(); |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
46 | $config->setDecorated(true); |
||
0 ignored issues
–
show
The method
Robo\Config\Config::setDecorated() has been deprecated with message: Use $config->set(Config::DECORATED, true)
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.
Loading history...
|
|||
47 | $config->setInteractive(true); |
||
0 ignored issues
–
show
The method
Robo\Config\Config::setInteractive() has been deprecated with message: Use $config->set(Config::INTERACTIVE, true)
This method has been deprecated. The supplier of the class has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.
Loading history...
|
|||
48 | $composer = test::double('Robo\Task\Composer\Install', ['executeCommand' => null, 'getConfig' => $config, 'logger' => new \Psr\Log\NullLogger()]); |
||
49 | |||
50 | (new \Robo\Task\Composer\Install('composer'))->run(); |
||
51 | $composer->verifyInvoked('executeCommand', ['composer install --ansi']); |
||
52 | |||
53 | (new \Robo\Task\Composer\Install('composer')) |
||
54 | ->preferSource() |
||
55 | ->run(); |
||
56 | $composer->verifyInvoked('executeCommand', ['composer install --prefer-source --ansi']); |
||
57 | |||
58 | (new \Robo\Task\Composer\Install('composer')) |
||
59 | ->optimizeAutoloader() |
||
60 | ->run(); |
||
61 | $composer->verifyInvoked('executeCommand', ['composer install --optimize-autoloader --ansi']); |
||
62 | } |
||
63 | |||
64 | View Code Duplication | public function testComposerUpdate() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
65 | { |
||
66 | $composer = test::double('Robo\Task\Composer\Update', ['executeCommand' => null, 'getConfig' => new \Robo\Config(), 'logger' => new \Psr\Log\NullLogger()]); |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
67 | |||
68 | (new \Robo\Task\Composer\Update('composer'))->run(); |
||
69 | $composer->verifyInvoked('executeCommand', ['composer update --no-interaction']); |
||
70 | |||
71 | (new \Robo\Task\Composer\Update('composer')) |
||
72 | ->optimizeAutoloader() |
||
73 | ->run(); |
||
74 | $composer->verifyInvoked('executeCommand', ['composer update --optimize-autoloader --no-interaction']); |
||
75 | } |
||
76 | |||
77 | public function testComposerDumpAutoload() |
||
78 | { |
||
79 | $composer = test::double('Robo\Task\Composer\DumpAutoload', ['executeCommand' => null, 'getConfig' => new \Robo\Config(), 'logger' => new \Psr\Log\NullLogger()]); |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
80 | |||
81 | (new \Robo\Task\Composer\DumpAutoload('composer'))->run(); |
||
82 | $composer->verifyInvoked('executeCommand', ['composer dump-autoload --no-interaction']); |
||
83 | |||
84 | (new \Robo\Task\Composer\DumpAutoload('composer')) |
||
85 | ->noDev() |
||
86 | ->run(); |
||
87 | $composer->verifyInvoked('executeCommand', ['composer dump-autoload --no-dev --no-interaction']); |
||
88 | |||
89 | (new \Robo\Task\Composer\DumpAutoload('composer')) |
||
90 | ->optimize() |
||
91 | ->run(); |
||
92 | $composer->verifyInvoked('executeCommand', ['composer dump-autoload --optimize --no-interaction']); |
||
93 | |||
94 | (new \Robo\Task\Composer\DumpAutoload('composer')) |
||
95 | ->optimize() |
||
96 | ->noDev() |
||
97 | ->run(); |
||
98 | $composer->verifyInvoked('executeCommand', ['composer dump-autoload --optimize --no-dev --no-interaction']); |
||
99 | } |
||
100 | |||
101 | public function testComposerValidate() |
||
102 | { |
||
103 | $composer = test::double('Robo\Task\Composer\Validate', ['executeCommand' => null, 'getConfig' => new \Robo\Config(), 'logger' => new \Psr\Log\NullLogger()]); |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
104 | |||
105 | (new \Robo\Task\Composer\Validate('composer'))->run(); |
||
106 | $composer->verifyInvoked('executeCommand', ['composer validate --no-interaction']); |
||
107 | |||
108 | (new \Robo\Task\Composer\Validate('composer')) |
||
109 | ->noCheckAll() |
||
110 | ->run(); |
||
111 | $composer->verifyInvoked('executeCommand', ['composer validate --no-check-all --no-interaction']); |
||
112 | |||
113 | (new \Robo\Task\Composer\Validate('composer')) |
||
114 | ->noCheckLock() |
||
115 | ->run(); |
||
116 | $composer->verifyInvoked('executeCommand', ['composer validate --no-check-lock --no-interaction']); |
||
117 | |||
118 | (new \Robo\Task\Composer\Validate('composer')) |
||
119 | ->noCheckPublish() |
||
120 | ->run(); |
||
121 | $composer->verifyInvoked('executeCommand', ['composer validate --no-check-publish --no-interaction']); |
||
122 | |||
123 | (new \Robo\Task\Composer\Validate('composer')) |
||
124 | ->withDependencies() |
||
125 | ->run(); |
||
126 | $composer->verifyInvoked('executeCommand', ['composer validate --with-dependencies --no-interaction']); |
||
127 | |||
128 | (new \Robo\Task\Composer\Validate('composer')) |
||
129 | ->strict() |
||
130 | ->run(); |
||
131 | $composer->verifyInvoked('executeCommand', ['composer validate --strict --no-interaction']); |
||
132 | } |
||
133 | |||
134 | public function testComposerInstallCommand() |
||
135 | { |
||
136 | verify( |
||
137 | (new \Robo\Task\Composer\Install('composer'))->setConfig(new \Robo\Config())->getCommand() |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
138 | )->equals('composer install --no-interaction'); |
||
139 | |||
140 | verify( |
||
141 | (new \Robo\Task\Composer\Install('composer')) |
||
142 | ->setConfig(new \Robo\Config()) |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
143 | ->noDev() |
||
144 | ->preferDist() |
||
145 | ->optimizeAutoloader() |
||
146 | ->getCommand() |
||
147 | )->equals('composer install --optimize-autoloader --prefer-dist --no-dev --no-interaction'); |
||
148 | } |
||
149 | |||
150 | public function testComposerUpdateCommand() |
||
151 | { |
||
152 | verify( |
||
153 | (new \Robo\Task\Composer\Update('composer'))->setConfig(new \Robo\Config())->getCommand() |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
154 | )->equals('composer update --no-interaction'); |
||
155 | |||
156 | verify( |
||
157 | (new \Robo\Task\Composer\Update('composer')) |
||
158 | ->setConfig(new \Robo\Config()) |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
159 | ->noDev() |
||
160 | ->preferDist() |
||
161 | ->getCommand() |
||
162 | )->equals('composer update --prefer-dist --no-dev --no-interaction'); |
||
163 | |||
164 | verify( |
||
165 | (new \Robo\Task\Composer\Update('composer')) |
||
166 | ->setConfig(new \Robo\Config()) |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
167 | ->noDev() |
||
168 | ->preferDist() |
||
169 | ->optimizeAutoloader() |
||
170 | ->getCommand() |
||
171 | )->equals('composer update --optimize-autoloader --prefer-dist --no-dev --no-interaction'); |
||
172 | } |
||
173 | |||
174 | public function testComposerDumpAutoloadCommand() |
||
175 | { |
||
176 | verify( |
||
177 | (new \Robo\Task\Composer\DumpAutoload('composer'))->setConfig(new \Robo\Config())->getCommand() |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
178 | )->equals('composer dump-autoload --no-interaction'); |
||
179 | |||
180 | verify( |
||
181 | (new \Robo\Task\Composer\DumpAutoload('composer')) |
||
182 | ->setConfig(new \Robo\Config()) |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
183 | ->noDev() |
||
184 | ->getCommand() |
||
185 | )->equals('composer dump-autoload --no-dev --no-interaction'); |
||
186 | |||
187 | verify( |
||
188 | (new \Robo\Task\Composer\DumpAutoload('composer')) |
||
189 | ->setConfig(new \Robo\Config()) |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
190 | ->optimize() |
||
191 | ->getCommand() |
||
192 | )->equals('composer dump-autoload --optimize --no-interaction'); |
||
193 | |||
194 | verify( |
||
195 | (new \Robo\Task\Composer\DumpAutoload('composer')) |
||
196 | ->setConfig(new \Robo\Config()) |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
197 | ->optimize() |
||
198 | ->noDev() |
||
199 | ->getCommand() |
||
200 | )->equals('composer dump-autoload --optimize --no-dev --no-interaction'); |
||
201 | } |
||
202 | |||
203 | public function testComposerRemove() |
||
204 | { |
||
205 | verify( |
||
206 | (new \Robo\Task\Composer\Remove('composer'))->setConfig(new \Robo\Config())->getCommand() |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
207 | )->equals('composer remove --no-interaction'); |
||
208 | verify( |
||
209 | (new \Robo\Task\Composer\Remove('composer')) |
||
210 | ->setConfig(new \Robo\Config()) |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
211 | ->dev() |
||
212 | ->noProgress() |
||
213 | ->noUpdate() |
||
214 | ->getCommand() |
||
215 | )->equals('composer remove --dev --no-progress --no-update --no-interaction'); |
||
216 | } |
||
217 | |||
218 | public function testComposerValidateCommand() |
||
219 | { |
||
220 | verify( |
||
221 | (new \Robo\Task\Composer\Validate('composer'))->setConfig(new \Robo\Config())->getCommand() |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
222 | )->equals('composer validate --no-interaction'); |
||
223 | |||
224 | verify( |
||
225 | (new \Robo\Task\Composer\Validate('composer')) |
||
226 | ->setConfig(new \Robo\Config()) |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
227 | ->noCheckAll() |
||
228 | ->getCommand() |
||
229 | )->equals('composer validate --no-check-all --no-interaction'); |
||
230 | |||
231 | verify( |
||
232 | (new \Robo\Task\Composer\Validate('composer')) |
||
233 | ->setConfig(new \Robo\Config()) |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
234 | ->noCheckLock() |
||
235 | ->getCommand() |
||
236 | )->equals('composer validate --no-check-lock --no-interaction'); |
||
237 | |||
238 | verify( |
||
239 | (new \Robo\Task\Composer\Validate('composer')) |
||
240 | ->setConfig(new \Robo\Config()) |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
241 | ->noCheckPublish() |
||
242 | ->getCommand() |
||
243 | )->equals('composer validate --no-check-publish --no-interaction'); |
||
244 | |||
245 | verify( |
||
246 | (new \Robo\Task\Composer\Validate('composer')) |
||
247 | ->setConfig(new \Robo\Config()) |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
248 | ->withDependencies() |
||
249 | ->getCommand() |
||
250 | )->equals('composer validate --with-dependencies --no-interaction'); |
||
251 | |||
252 | verify( |
||
253 | (new \Robo\Task\Composer\Validate('composer')) |
||
254 | ->setConfig(new \Robo\Config()) |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
255 | ->strict() |
||
256 | ->getCommand() |
||
257 | )->equals('composer validate --strict --no-interaction'); |
||
258 | |||
259 | verify( |
||
260 | (new \Robo\Task\Composer\Validate('composer')) |
||
261 | ->setConfig(new \Robo\Config()) |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
262 | ->noCheckAll() |
||
263 | ->noCheckLock() |
||
264 | ->noCheckPublish() |
||
265 | ->withDependencies() |
||
266 | ->strict() |
||
267 | ->getCommand() |
||
268 | )->equals('composer validate --no-check-all --no-check-lock --no-check-publish --with-dependencies --strict --no-interaction'); |
||
269 | } |
||
270 | |||
271 | public function testComposerInitCommand() |
||
272 | { |
||
273 | verify( |
||
274 | (new \Robo\Task\Composer\Init('composer'))->setConfig(new \Robo\Config())->getCommand() |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
275 | )->equals('composer init --no-interaction'); |
||
276 | |||
277 | verify( |
||
278 | (new \Robo\Task\Composer\Init('composer')) |
||
279 | ->setConfig(new \Robo\Config()) |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
280 | ->projectName('foo/bar') |
||
281 | ->description('A test project') |
||
282 | ->dependency('baz/boz', '^2.4.8') |
||
283 | ->projectType('project') |
||
284 | ->homepage('https://foo.bar.com') |
||
285 | ->stability('beta') |
||
286 | ->license('MIT') |
||
287 | ->repository('https://packages.drupal.org/8') |
||
288 | ->getCommand() |
||
289 | )->equals($this->adjustQuotes("composer init --name foo/bar --description 'A test project' --require 'baz/boz:^2.4.8' --type project --homepage 'https://foo.bar.com' --stability beta --license MIT --repository 'https://packages.drupal.org/8' --no-interaction")); |
||
290 | |||
291 | } |
||
292 | |||
293 | public function testComposerConfigCommand() |
||
294 | { |
||
295 | verify( |
||
296 | (new \Robo\Task\Composer\Config('composer')) |
||
297 | ->setConfig(new \Robo\Config()) |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
298 | ->set('bin-dir', 'bin/') |
||
299 | ->getCommand() |
||
300 | )->equals("composer config bin-dir bin/ --no-interaction"); |
||
301 | |||
302 | verify( |
||
303 | (new \Robo\Task\Composer\Config('composer')) |
||
304 | ->setConfig(new \Robo\Config()) |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
305 | ->useGlobal() |
||
306 | ->set('bin-dir', 'bin/') |
||
307 | ->getCommand() |
||
308 | )->equals("composer config --global bin-dir bin/ --no-interaction"); |
||
309 | |||
310 | verify( |
||
311 | (new \Robo\Task\Composer\Config('composer')) |
||
312 | ->setConfig(new \Robo\Config()) |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
313 | ->repository('drupalorg', 'https://packages.drupal.org/8', 'composer') |
||
314 | ->getCommand() |
||
315 | )->equals($this->adjustQuotes("composer config repositories.drupalorg composer 'https://packages.drupal.org/8' --no-interaction")); |
||
316 | } |
||
317 | |||
318 | public function testComposerRequireCommand() |
||
319 | { |
||
320 | verify( |
||
321 | (new \Robo\Task\Composer\RequireDependency('composer')) |
||
322 | ->setConfig(new \Robo\Config()) |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
323 | ->dependency('foo/bar', '^2.4.8') |
||
324 | ->getCommand() |
||
325 | )->equals($this->adjustQuotes("composer require 'foo/bar:^2.4.8' --no-interaction")); |
||
326 | |||
327 | verify( |
||
328 | (new \Robo\Task\Composer\RequireDependency('composer')) |
||
329 | ->setConfig(new \Robo\Config()) |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
330 | ->dependency(['a/b', 'x/y:^1']) |
||
331 | ->getCommand() |
||
332 | )->equals($this->adjustQuotes("composer require a/b 'x/y:^1' --no-interaction")); |
||
333 | } |
||
334 | |||
335 | public function testComposerCreateProjectCommand() |
||
336 | { |
||
337 | verify( |
||
338 | (new \Robo\Task\Composer\CreateProject('composer')) |
||
339 | ->setConfig(new \Robo\Config()) |
||
0 ignored issues
–
show
The class
Robo\Config has been deprecated with message: Use \Robo\Config\Config
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.
Loading history...
|
|||
340 | ->source('foo/bar') |
||
341 | ->version('^2.4.8') |
||
342 | ->target('mybar') |
||
343 | ->repository('https://packages.drupal.org/8') |
||
344 | ->keepVcs() |
||
345 | ->noInstall() |
||
346 | ->getCommand() |
||
347 | )->equals($this->adjustQuotes("composer create-project --repository 'https://packages.drupal.org/8' --keep-vcs --no-install foo/bar mybar '^2.4.8' --no-interaction")); |
||
348 | } |
||
349 | } |
||
350 |
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: