ComposerTest::testComposerInstall()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17

Duplication

Lines 17
Ratio 100 %

Importance

Changes 0
Metric Value
dl 17
loc 17
rs 9.7
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
use AspectMock\Test as test;
0 ignored issues
show
Bug introduced by
This use statement conflicts with another class in this namespace, test.

Let’s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let’s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/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 before OtherDir/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:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
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', [
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
Duplication introduced by
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
Deprecated Code introduced by
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
Deprecated Code introduced by
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
Deprecated Code introduced by
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
Deprecated Code introduced by
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
Duplication introduced by
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
Deprecated Code introduced by
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
Deprecated Code introduced by
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
Deprecated Code introduced by
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
        $this->assertEquals(
137
            'composer install --no-interaction',
138
            (new \Robo\Task\Composer\Install('composer'))->setConfig(new \Robo\Config())->getCommand()
0 ignored issues
show
Deprecated Code introduced by
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...
139
        );
140
141
        $this->assertEquals(
142
            'composer install --optimize-autoloader --prefer-dist --no-dev --no-interaction',
143
            (new \Robo\Task\Composer\Install('composer'))
144
                ->setConfig(new \Robo\Config())
0 ignored issues
show
Deprecated Code introduced by
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...
145
                ->noDev()
146
                ->preferDist()
147
                ->optimizeAutoloader()
148
                ->getCommand()
149
        );
150
    }
151
152
    public function testComposerUpdateCommand()
153
    {
154
        $this->assertEquals(
155
            'composer update --no-interaction',
156
            (new \Robo\Task\Composer\Update('composer'))->setConfig(new \Robo\Config())->getCommand()
0 ignored issues
show
Deprecated Code introduced by
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...
157
        );
158
159
        $this->assertEquals(
160
            'composer update --prefer-dist --no-dev --no-interaction',
161
            (new \Robo\Task\Composer\Update('composer'))
162
                ->setConfig(new \Robo\Config())
0 ignored issues
show
Deprecated Code introduced by
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...
163
                ->noDev()
164
                ->preferDist()
165
                ->getCommand()
166
        );
167
168
        $this->assertEquals(
169
            'composer update --optimize-autoloader --prefer-dist --no-dev --no-interaction',
170
            (new \Robo\Task\Composer\Update('composer'))
171
                ->setConfig(new \Robo\Config())
0 ignored issues
show
Deprecated Code introduced by
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...
172
                ->noDev()
173
                ->preferDist()
174
                ->optimizeAutoloader()
175
                ->getCommand()
176
        );
177
    }
178
179
    public function testComposerDumpAutoloadCommand()
180
    {
181
        $this->assertEquals(
182
            'composer dump-autoload --no-interaction',
183
            (new \Robo\Task\Composer\DumpAutoload('composer'))->setConfig(new \Robo\Config())->getCommand()
0 ignored issues
show
Deprecated Code introduced by
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...
184
        );
185
186
        $this->assertEquals(
187
            'composer dump-autoload --no-dev --no-interaction',
188
            (new \Robo\Task\Composer\DumpAutoload('composer'))
189
                ->setConfig(new \Robo\Config())
0 ignored issues
show
Deprecated Code introduced by
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
                ->noDev()
191
                ->getCommand()
192
        );
193
194
        $this->assertEquals(
195
            'composer dump-autoload --optimize --no-interaction',
196
            (new \Robo\Task\Composer\DumpAutoload('composer'))
197
                ->setConfig(new \Robo\Config())
0 ignored issues
show
Deprecated Code introduced by
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...
198
                ->optimize()
199
                ->getCommand()
200
        );
201
202
        $this->assertEquals(
203
            'composer dump-autoload --optimize --no-dev --no-interaction',
204
            (new \Robo\Task\Composer\DumpAutoload('composer'))
205
                ->setConfig(new \Robo\Config())
0 ignored issues
show
Deprecated Code introduced by
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...
206
                ->optimize()
207
                ->noDev()
208
                ->getCommand()
209
        );
210
    }
211
212
    public function testComposerRemove()
213
    {
214
        $this->assertEquals(
215
            'composer remove --no-interaction',
216
            (new \Robo\Task\Composer\Remove('composer'))->setConfig(new \Robo\Config())->getCommand()
0 ignored issues
show
Deprecated Code introduced by
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...
217
        );
218
        $this->assertEquals(
219
            'composer remove --dev --no-progress --no-update --no-interaction',
220
            (new \Robo\Task\Composer\Remove('composer'))
221
                ->setConfig(new \Robo\Config())
0 ignored issues
show
Deprecated Code introduced by
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
                ->dev()
223
                ->noProgress()
224
                ->noUpdate()
225
                ->getCommand()
226
        );
227
    }
228
229
    public function testComposerValidateCommand()
230
    {
231
        $this->assertEquals(
232
            'composer validate --no-interaction',
233
            (new \Robo\Task\Composer\Validate('composer'))->setConfig(new \Robo\Config())->getCommand()
0 ignored issues
show
Deprecated Code introduced by
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
        );
235
236
        $this->assertEquals(
237
            'composer validate --no-check-all --no-interaction',
238
            (new \Robo\Task\Composer\Validate('composer'))
239
                ->setConfig(new \Robo\Config())
0 ignored issues
show
Deprecated Code introduced by
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...
240
                ->noCheckAll()
241
                ->getCommand()
242
        );
243
244
        $this->assertEquals(
245
            'composer validate --no-check-lock --no-interaction',
246
            (new \Robo\Task\Composer\Validate('composer'))
247
                ->setConfig(new \Robo\Config())
0 ignored issues
show
Deprecated Code introduced by
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
                ->noCheckLock()
249
                ->getCommand()
250
        );
251
252
        $this->assertEquals(
253
            'composer validate --no-check-publish --no-interaction',
254
            (new \Robo\Task\Composer\Validate('composer'))
255
                ->setConfig(new \Robo\Config())
0 ignored issues
show
Deprecated Code introduced by
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...
256
                ->noCheckPublish()
257
                ->getCommand()
258
        );
259
260
        $this->assertEquals(
261
            'composer validate --with-dependencies --no-interaction',
262
            (new \Robo\Task\Composer\Validate('composer'))
263
                ->setConfig(new \Robo\Config())
0 ignored issues
show
Deprecated Code introduced by
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...
264
                ->withDependencies()
265
                ->getCommand()
266
        );
267
268
        $this->assertEquals(
269
            'composer validate --strict --no-interaction',
270
            (new \Robo\Task\Composer\Validate('composer'))
271
                ->setConfig(new \Robo\Config())
0 ignored issues
show
Deprecated Code introduced by
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...
272
                ->strict()
273
                ->getCommand()
274
        );
275
276
        $this->assertEquals(
277
            'composer validate --no-check-all --no-check-lock --no-check-publish --with-dependencies --strict --no-interaction',
278
            (new \Robo\Task\Composer\Validate('composer'))
279
                ->setConfig(new \Robo\Config())
0 ignored issues
show
Deprecated Code introduced by
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
                ->noCheckAll()
281
                ->noCheckLock()
282
                ->noCheckPublish()
283
                ->withDependencies()
284
                ->strict()
285
                ->getCommand()
286
        );
287
    }
288
289
    public function testComposerInitCommand()
290
    {
291
        $this->assertEquals(
292
            'composer init --no-interaction',
293
            (new \Robo\Task\Composer\Init('composer'))->setConfig(new \Robo\Config())->getCommand()
0 ignored issues
show
Deprecated Code introduced by
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...
294
        );
295
296
        $this->assertEquals(
297
            $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"),
298
            (new \Robo\Task\Composer\Init('composer'))
299
                ->setConfig(new \Robo\Config())
0 ignored issues
show
Deprecated Code introduced by
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...
300
                ->projectName('foo/bar')
301
                ->description('A test project')
302
                ->dependency('baz/boz', '^2.4.8')
303
                ->projectType('project')
304
                ->homepage('https://foo.bar.com')
305
                ->stability('beta')
306
                ->license('MIT')
307
                ->repository('https://packages.drupal.org/8')
308
                ->getCommand()
309
        );
310
311
    }
312
313
    public function testComposerConfigCommand()
314
    {
315
        $this->assertEquals(
316
            "composer config bin-dir bin/ --no-interaction",
317
            (new \Robo\Task\Composer\Config('composer'))
318
                ->setConfig(new \Robo\Config())
0 ignored issues
show
Deprecated Code introduced by
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...
319
                ->set('bin-dir', 'bin/')
320
                ->getCommand()
321
        );
322
323
        $this->assertEquals(
324
            "composer config --global bin-dir bin/ --no-interaction",
325
            (new \Robo\Task\Composer\Config('composer'))
326
                ->setConfig(new \Robo\Config())
0 ignored issues
show
Deprecated Code introduced by
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...
327
                ->useGlobal()
328
                ->set('bin-dir', 'bin/')
329
                ->getCommand()
330
        );
331
332
        $this->assertEquals(
333
            $this->adjustQuotes("composer config repositories.drupalorg composer 'https://packages.drupal.org/8' --no-interaction"),
334
            (new \Robo\Task\Composer\Config('composer'))
335
                ->setConfig(new \Robo\Config())
0 ignored issues
show
Deprecated Code introduced by
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...
336
                ->repository('drupalorg', 'https://packages.drupal.org/8', 'composer')
337
                ->getCommand()
338
        );
339
    }
340
341
    public function testComposerRequireCommand()
342
    {
343
        $this->assertEquals(
344
            $this->adjustQuotes("composer require 'foo/bar:^2.4.8' --no-interaction"),
345
            (new \Robo\Task\Composer\RequireDependency('composer'))
346
                ->setConfig(new \Robo\Config())
0 ignored issues
show
Deprecated Code introduced by
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...
347
                ->dependency('foo/bar', '^2.4.8')
348
                ->getCommand()
349
        );
350
351
        $this->assertEquals(
352
            $this->adjustQuotes("composer require a/b 'x/y:^1' --no-interaction"),
353
            (new \Robo\Task\Composer\RequireDependency('composer'))
354
                ->setConfig(new \Robo\Config())
0 ignored issues
show
Deprecated Code introduced by
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...
355
                ->dependency(['a/b', 'x/y:^1'])
0 ignored issues
show
Documentation introduced by
array('a/b', 'x/y:^1') is of type array<integer,string,{"0":"string","1":"string"}>, but the function expects a string.

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:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
356
                ->getCommand()
357
        );
358
    }
359
360
    public function testComposerCreateProjectCommand()
361
    {
362
        $this->assertEquals(
363
            $this->adjustQuotes("composer create-project --repository 'https://packages.drupal.org/8' --keep-vcs --no-install foo/bar mybar '^2.4.8' --no-interaction"),
364
            (new \Robo\Task\Composer\CreateProject('composer'))
365
                ->setConfig(new \Robo\Config())
0 ignored issues
show
Deprecated Code introduced by
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...
366
                ->source('foo/bar')
367
                ->version('^2.4.8')
368
                ->target('mybar')
369
                ->repository('https://packages.drupal.org/8')
370
                ->keepVcs()
371
                ->noInstall()
372
                ->getCommand()
373
        );
374
    }
375
}
376