This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Bowerphp\Test; |
||
4 | |||
5 | use Bowerphp\Bowerphp; |
||
6 | use Guzzle\Http\Exception\RequestException; |
||
7 | use Mockery; |
||
8 | use Mockery\MockInterface; |
||
9 | use RuntimeException; |
||
10 | |||
11 | /** |
||
12 | * @group bowerphp |
||
13 | */ |
||
14 | class BowerphpTest extends BowerphpTestCase |
||
0 ignored issues
–
show
|
|||
15 | { |
||
16 | protected $bowerphp; |
||
17 | |||
18 | protected $config; |
||
19 | |||
20 | protected $repository; |
||
21 | |||
22 | protected function setUp() |
||
23 | { |
||
24 | parent::setUp(); |
||
25 | $this->config = Mockery::mock('Bowerphp\Config\ConfigInterface'); |
||
26 | $this->repository = Mockery::mock('Bowerphp\Repository\RepositoryInterface'); |
||
27 | $this->output = Mockery::mock('Bowerphp\Output\BowerphpConsoleOutput'); |
||
28 | |||
29 | $this->config |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
30 | ->shouldReceive('getBasePackagesUrl')->andReturn('http://bower.herokuapp.com/packages/') |
||
31 | ->shouldReceive('getInstallDir')->andReturn(getcwd() . '/bower_components') |
||
32 | ->shouldReceive('getCacheDir')->andReturn('.') |
||
33 | ; |
||
34 | } |
||
35 | |||
36 | public function testInit() |
||
37 | { |
||
38 | $json = <<<'EOT' |
||
39 | { |
||
40 | "name": "Foo", |
||
41 | "authors": [ |
||
42 | "Beelab <[email protected]>", |
||
43 | "Mallo" |
||
44 | ], |
||
45 | "private": true, |
||
46 | "dependencies": { |
||
47 | |||
48 | } |
||
49 | } |
||
50 | EOT; |
||
51 | $params = ['name' => 'Foo', 'author' => 'Mallo']; |
||
52 | |||
53 | $this->config |
||
54 | ->shouldReceive('initBowerJsonFile')->with($params)->andReturn(123) |
||
55 | ->shouldReceive('bowerFileExists')->andReturn(false, true) |
||
56 | ->shouldReceive('getBowerFileContent')->andReturn(['name' => 'Bar']) |
||
57 | ->shouldReceive('setSaveToBowerJsonFile') |
||
58 | ->shouldReceive('getOverridesSection')->andReturn([]) |
||
59 | ->shouldReceive('getOverrideFor')->andReturn([]) |
||
60 | ->shouldReceive('updateBowerJsonFile2')->with(['name' => 'Bar'], $params)->andReturn(456) |
||
61 | ; |
||
62 | |||
63 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
64 | $bowerphp->init($params); |
||
65 | $bowerphp->init($params); |
||
66 | } |
||
67 | |||
68 | public function testInstallPackage() |
||
69 | { |
||
70 | $this->mockLookup(); |
||
71 | |||
72 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
73 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
74 | $this->installPackage($package, $installer, ['jquery'], ['2.0.3']); |
||
75 | |||
76 | $this->filesystem |
||
77 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery/.bower.json')->andReturn(false) |
||
78 | ->shouldReceive('write')->with('./tmp/jquery', 'fileAsString...') |
||
79 | ; |
||
80 | |||
81 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
82 | $bowerphp->installPackage($package, $installer); |
||
83 | } |
||
84 | |||
85 | public function testInstallPackageFromGithubEndPoint() |
||
86 | { |
||
87 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
88 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
89 | |||
90 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
91 | ->shouldReceive('getName')->andReturn('https://github.com/ivaynberg/select2.git') |
||
92 | ->shouldReceive('getRequiredVersion')->andReturn('3.5.1') |
||
93 | ->shouldReceive('setRepository')->with($this->repository) |
||
94 | ->shouldReceive('setInfo') |
||
95 | ->shouldReceive('setVersion') |
||
96 | ->shouldReceive('getRequires') |
||
97 | ; |
||
98 | |||
99 | $this->repository |
||
100 | ->shouldReceive('setUrl->setHttpClient') |
||
101 | ; |
||
102 | $this->repository |
||
103 | ->shouldReceive('findPackage')->with('3.5.1')->andReturn('3.5.1') |
||
104 | ->shouldReceive('getRelease')->andReturn('fileAsString...') |
||
105 | ; |
||
106 | |||
107 | $this->filesystem |
||
108 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/select2/.bower.json')->andReturn(false) |
||
109 | ->shouldReceive('write')->with('./tmp/select2', 'fileAsString...') |
||
110 | ; |
||
111 | |||
112 | $this->output |
||
0 ignored issues
–
show
|
|||
113 | ->shouldReceive('writelnInfoPackage') |
||
114 | ->shouldReceive('writelnInstalledPackage') |
||
115 | ; |
||
116 | $this->config |
||
117 | ->shouldReceive('getOverridesSection')->andReturn([]) |
||
118 | ->shouldReceive('getOverrideFor')->andReturn([]) |
||
119 | ->shouldReceive('isSaveToBowerJsonFile')->andReturn(false) |
||
120 | ; |
||
121 | |||
122 | $installer |
||
123 | ->shouldReceive('install') |
||
124 | ; |
||
125 | |||
126 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
127 | $bowerphp->installPackage($package, $installer); |
||
128 | } |
||
129 | |||
130 | /** |
||
131 | * @expectedException \RuntimeException |
||
132 | * @expectedExceptionMessage Cannot find package select2 version 3.4.5. |
||
133 | */ |
||
134 | public function testInstallPackageFromGithubEndPointVersionNotFound() |
||
135 | { |
||
136 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
137 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
138 | |||
139 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
140 | ->shouldReceive('getName')->andReturn('https://github.com/ivaynberg/select2.git') |
||
141 | ->shouldReceive('getRequiredVersion')->andReturn('3.4.5') |
||
142 | ->shouldReceive('setRepository')->with($this->repository) |
||
143 | ->shouldReceive('setInfo') |
||
144 | ->shouldReceive('setVersion') |
||
145 | ; |
||
146 | |||
147 | $this->repository |
||
148 | ->shouldReceive('setUrl->setHttpClient') |
||
149 | ; |
||
150 | $this->repository |
||
151 | ->shouldReceive('findPackage')->with('3.4.5')->andReturn(null) |
||
152 | ; |
||
153 | |||
154 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
155 | $bowerphp->installPackage($package, $installer); |
||
156 | } |
||
157 | |||
158 | public function testDoNotInstallAlreadyInstalledPackage() |
||
159 | { |
||
160 | $this->mockLookup(); |
||
161 | |||
162 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
163 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
164 | $request = Mockery::mock('Guzzle\Http\Message\RequestInterface'); |
||
165 | $response = Mockery::mock('Guzzle\Http\Message\Response'); |
||
166 | |||
167 | $packageJson = '{"name":"jquery","url":"git://github.com/components/jquery.git"}'; |
||
168 | $bowerJson = '{"name":"jquery","version":"2.0.3", "main":"jquery.js"}'; |
||
169 | |||
170 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
171 | ->shouldReceive('getName')->andReturn('jquery') |
||
172 | ->shouldReceive('getRequiredVersion')->andReturn('*') |
||
173 | ->shouldReceive('setRepository')->with($this->repository) |
||
174 | ->shouldReceive('setVersion')->with('2.0.3') |
||
175 | ->shouldReceive('setInfo')->with(['name' => 'jquery', 'version' => '2.0.3', 'main' => 'jquery.js']) |
||
176 | ; |
||
177 | |||
178 | $this->config |
||
179 | ->shouldReceive('getPackageBowerFileContent')->andReturn(['name' => 'jquery', 'version' => '2.0.3']) |
||
180 | ->shouldReceive('isSaveToBowerJsonFile')->andReturn(false) |
||
181 | ; |
||
182 | |||
183 | $this->filesystem |
||
184 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery/.bower.json')->andReturn(true) |
||
185 | ; |
||
186 | |||
187 | $this->httpClient |
||
188 | ->shouldReceive('get')->with('http://bower.herokuapp.com/packages/jquery')->andReturn($request) |
||
189 | ; |
||
190 | $this->repository |
||
191 | ->shouldReceive('findPackage')->with('*')->andReturn('2.0.3') |
||
192 | ; |
||
193 | $request |
||
194 | ->shouldReceive('send')->andReturn($response) |
||
195 | ; |
||
196 | $response |
||
197 | ->shouldReceive('getBody')->andReturn($packageJson) |
||
198 | ; |
||
199 | $this->repository |
||
200 | ->shouldReceive('setUrl->setHttpClient'); |
||
201 | $this->repository |
||
202 | ->shouldReceive('getBower')->andReturn($bowerJson) |
||
203 | ; |
||
204 | |||
205 | $installer |
||
206 | ->shouldReceive('install')->never() |
||
207 | ; |
||
208 | |||
209 | $this->output |
||
0 ignored issues
–
show
|
|||
210 | ->shouldReceive('writelnInfoPackage') |
||
211 | ; |
||
212 | |||
213 | //$this->filesystem |
||
214 | // ->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery/.bower.json')->andReturn(false) |
||
215 | // ->shouldReceive('dumpFile')->with('./tmp/jquery', "fileAsString...", 0644) |
||
216 | //; |
||
217 | |||
218 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
219 | $bowerphp->installPackage($package, $installer); |
||
220 | } |
||
221 | |||
222 | public function testInstallPackageAndSaveBowerJson() |
||
223 | { |
||
224 | $this->mockLookup(); |
||
225 | |||
226 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
227 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
228 | |||
229 | $this->config |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
230 | ->shouldReceive('isSaveToBowerJsonFile')->andReturn(true) |
||
231 | ->shouldReceive('updateBowerJsonFile')->with($package) |
||
232 | ; |
||
233 | |||
234 | $this->filesystem |
||
235 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery/.bower.json')->andReturn(false) |
||
236 | ->shouldReceive('write')->with('./tmp/jquery', 'fileAsString...') |
||
237 | ; |
||
238 | |||
239 | $this->installPackage($package, $installer, ['jquery'], ['2.0.3']); |
||
240 | |||
241 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
242 | $bowerphp->installPackage($package, $installer); |
||
243 | } |
||
244 | |||
245 | public function testInstallPackageAndSaveBowerJsonException() |
||
246 | { |
||
247 | $this->mockLookup(); |
||
248 | |||
249 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
250 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
251 | |||
252 | $this->config |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
253 | ->shouldReceive('isSaveToBowerJsonFile')->andReturn(true) |
||
254 | ->shouldReceive('updateBowerJsonFile')->with($package)->andThrow(new RuntimeException()) |
||
255 | ; |
||
256 | |||
257 | $this->output |
||
0 ignored issues
–
show
|
|||
258 | ->shouldReceive('writelnNoBowerJsonFile') |
||
259 | ; |
||
260 | |||
261 | $this->filesystem |
||
262 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery/.bower.json')->andReturn(false) |
||
263 | ->shouldReceive('write')->with('./tmp/jquery', 'fileAsString...') |
||
264 | ; |
||
265 | |||
266 | $this->installPackage($package, $installer, ['jquery'], ['2.0.3']); |
||
267 | |||
268 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
269 | $bowerphp->installPackage($package, $installer); |
||
270 | } |
||
271 | |||
272 | public function testInstallDependencies() |
||
273 | { |
||
274 | $this->mockLookup(); |
||
275 | |||
276 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
277 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
278 | |||
279 | $this->installPackage($package, $installer, ['jquery'], ['2.0.1'], ['>=1.6']); |
||
280 | $json = ['name' => 'pippo', 'dependencies' => ['jquery' => '>=1.6']]; |
||
281 | |||
282 | $this->config |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
283 | ->shouldReceive('getBowerFileContent')->andReturn($json) |
||
284 | ; |
||
285 | |||
286 | $this->filesystem |
||
287 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery/.bower.json')->andReturn(false) |
||
288 | ->shouldReceive('write')->with('./tmp/jquery', 'fileAsString...') |
||
289 | ; |
||
290 | |||
291 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
292 | $bowerphp->installDependencies($installer); |
||
293 | } |
||
294 | |||
295 | public function testInstallDependenciesWithGithubEndpoint() |
||
296 | { |
||
297 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
298 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
299 | |||
300 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
301 | ->shouldReceive('getName')->andReturn('https://github.com/ivaynberg/select2.git') |
||
302 | ->shouldReceive('getRequiredVersion')->andReturn('3.5.1') |
||
303 | ->shouldReceive('setRepository')->with($this->repository) |
||
304 | ->shouldReceive('setInfo') |
||
305 | ->shouldReceive('setVersion') |
||
306 | ->shouldReceive('getRequires') |
||
307 | ; |
||
308 | |||
309 | $this->repository |
||
310 | ->shouldReceive('setUrl->setHttpClient') |
||
311 | ; |
||
312 | $this->repository |
||
313 | ->shouldReceive('findPackage')->with('3.5.1')->andReturn('3.5.1') |
||
314 | ->shouldReceive('getRelease')->andReturn('fileAsString...') |
||
315 | ; |
||
316 | |||
317 | $this->filesystem |
||
318 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/select2/.bower.json')->andReturn(false) |
||
319 | ->shouldReceive('write')->with('./tmp/select2', 'fileAsString...') |
||
320 | ; |
||
321 | |||
322 | $this->output |
||
0 ignored issues
–
show
|
|||
323 | ->shouldReceive('writelnInfoPackage') |
||
324 | ->shouldReceive('writelnInstalledPackage') |
||
325 | ; |
||
326 | |||
327 | $json = [ |
||
328 | 'name' => 'pippo', |
||
329 | 'dependencies' => ['select2' => 'https://github.com/ivaynberg/select2.git#3.5.1'], |
||
330 | ]; |
||
331 | $this->config |
||
332 | ->shouldReceive('getOverridesSection')->andReturn([]) |
||
333 | ->shouldReceive('getOverrideFor')->andReturn([]) |
||
334 | ->shouldReceive('getBowerFileContent')->andReturn($json) |
||
335 | ->shouldReceive('isSaveToBowerJsonFile')->andReturn(false) |
||
336 | ; |
||
337 | |||
338 | $installer |
||
339 | ->shouldReceive('install') |
||
340 | ; |
||
341 | |||
342 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
343 | $bowerphp->installDependencies($installer); |
||
344 | } |
||
345 | |||
346 | /** |
||
347 | * @expectedException \RuntimeException |
||
348 | */ |
||
349 | public function testInstallDependenciesException() |
||
350 | { |
||
351 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
352 | |||
353 | $json = '{"invalid json'; |
||
354 | $this->config |
||
355 | ->shouldReceive('getBowerFileContent')->andThrow(new RuntimeException(sprintf('Malformed JSON'))) |
||
356 | ; |
||
357 | |||
358 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
359 | $bowerphp->installDependencies($installer); |
||
360 | } |
||
361 | |||
362 | public function testUpdatePackage() |
||
363 | { |
||
364 | $this->mockLookup('less', '{"name":"less","url":"git://github.com/less/less.git"}'); |
||
365 | |||
366 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
367 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
368 | |||
369 | $bowerJson = '{"name": "Foo", "dependencies": {"less": "*"}}'; |
||
370 | |||
371 | $this->installPackage($package, $installer, ['less'], ['1.2.1'], [null], true, ['1.2.3']); |
||
372 | |||
373 | $this->config |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
374 | ->shouldReceive('getBowerFileContent')->andReturn(json_decode($bowerJson, true)) |
||
375 | ; |
||
376 | |||
377 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
378 | $bowerphp->updatePackage($package, $installer); |
||
379 | } |
||
380 | |||
381 | /** |
||
382 | * @expectedException \InvalidArgumentException |
||
383 | * @expectedExceptionMessage Package notinbowerjson not found in bower.json |
||
384 | */ |
||
385 | public function testUpdatePackageNotFoundInBowerJson() |
||
386 | { |
||
387 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
388 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
389 | |||
390 | $bowerJson = '{"name": "Foo", "dependencies": {"less": "*"}}'; |
||
391 | $packageJson = '{"name":"less","url":"git://github.com/less/less.git","version":"1.2.1"}'; |
||
392 | |||
393 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
394 | ->shouldReceive('getName')->andReturn('notinbowerjson') |
||
395 | ->shouldReceive('getRequiredVersion')->andReturn(null) |
||
396 | ; |
||
397 | |||
398 | $this->filesystem |
||
399 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/notinbowerjson/.bower.json')->andReturn(true) |
||
400 | ; |
||
401 | |||
402 | $this->config |
||
403 | ->shouldReceive('getBowerFileContent')->andReturn(json_decode($bowerJson, true)) |
||
404 | ; |
||
405 | |||
406 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
407 | $bowerphp->updatePackage($package, $installer); |
||
408 | } |
||
409 | |||
410 | /** |
||
411 | * @expectedException \RuntimeException |
||
412 | * @expectedExceptionMessage Cannot fetch registry info for package jquery from search registry (error). |
||
413 | */ |
||
414 | public function testUpdatePackageNotFoundInRepository() |
||
415 | { |
||
416 | $guzzle = Mockery::mock('Github\HttpClient\HttpClientInterface'); |
||
417 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
418 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
419 | |||
420 | $this->httpClient |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
421 | ->shouldReceive('getHttpClient')->andReturn($guzzle) |
||
422 | ; |
||
423 | |||
424 | $package |
||
425 | ->shouldReceive('getName')->andReturn('jquery') |
||
426 | ->shouldReceive('getRequiredVersion')->andReturn('*') |
||
427 | ->shouldReceive('setInfo')->with(['name' => 'jquery', 'version' => '1.0.0']) |
||
428 | ->shouldReceive('setVersion')->with('1.0.0') |
||
429 | ->shouldReceive('setRequires')->with(null) |
||
430 | ; |
||
431 | |||
432 | $this->filesystem |
||
433 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery/.bower.json')->andReturn(true) |
||
434 | ; |
||
435 | |||
436 | $this->config |
||
437 | ->shouldReceive('getPackageBowerFileContent')->andReturn(['name' => 'jquery', 'version' => '1.0.0']) |
||
438 | ; |
||
439 | |||
440 | $guzzle |
||
441 | ->shouldReceive('get')->with('http://bower.herokuapp.com/packages/jquery')->andThrow(new RequestException('error')) |
||
442 | ; |
||
443 | |||
444 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
445 | $bowerphp->updatePackage($package, $installer); |
||
446 | } |
||
447 | |||
448 | /** |
||
449 | * @expectedException \RuntimeException |
||
450 | * @expectedExceptionMessage Registry info for package colorbox has malformed json or is missing "url". |
||
451 | */ |
||
452 | public function testUpdatePackageJsonException() |
||
453 | { |
||
454 | $this->mockLookup('colorbox', '{invalid'); |
||
455 | |||
456 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
457 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
458 | |||
459 | $this->filesystem |
||
460 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/colorbox/.bower.json')->andReturn(true) |
||
461 | ; |
||
462 | |||
463 | $this->config |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
464 | ->shouldReceive('getPackageBowerFileContent')->andReturn(['name' => 'colorbox', 'version' => '1.0.0']) |
||
465 | ; |
||
466 | |||
467 | $package |
||
468 | ->shouldReceive('getName')->andReturn('colorbox') |
||
469 | ->shouldReceive('getRequiredVersion')->andReturn('*') |
||
470 | ->shouldReceive('setInfo')->with(['name' => 'colorbox', 'version' => '1.0.0']) |
||
471 | ->shouldReceive('setVersion')->with('1.0.0') |
||
472 | ->shouldReceive('setRequires')->with(null) |
||
473 | ; |
||
474 | |||
475 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
476 | $bowerphp->updatePackage($package, $installer); |
||
477 | } |
||
478 | |||
479 | /** |
||
480 | * @expectedException \RuntimeException |
||
481 | * @expectedExceptionMessage Invalid bower.json found in package colorbox: {invalid. |
||
482 | */ |
||
483 | public function testUpdatePackageWithInvalidBowerJson() |
||
484 | { |
||
485 | $this->mockLookup('colorbox', '{"name":"colorbox","url":"git://github.com/jackmoore/colorbox.git"}'); |
||
486 | |||
487 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
488 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
489 | |||
490 | $this->filesystem |
||
491 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/colorbox/.bower.json')->andReturn(true) |
||
492 | ; |
||
493 | |||
494 | $this->config |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
495 | ->shouldReceive('getPackageBowerFileContent')->andReturn(['name' => 'colorbox', 'version' => '1.0.0']) |
||
496 | ; |
||
497 | |||
498 | $package |
||
499 | ->shouldReceive('getName')->andReturn('colorbox') |
||
500 | ->shouldReceive('getRequiredVersion')->andReturn('*') |
||
501 | ->shouldReceive('setInfo')->with(['name' => 'colorbox', 'version' => '1.0.0']) |
||
502 | ->shouldReceive('setVersion')->with('1.0.0') |
||
503 | ->shouldReceive('setRequires')->with(null) |
||
504 | ; |
||
505 | |||
506 | $this->repository |
||
507 | ->shouldReceive('setUrl->setHttpClient'); |
||
508 | $this->repository |
||
509 | ->shouldReceive('findPackage')->with('*')->andReturn('1.0.0') |
||
510 | ->shouldReceive('getBower')->andReturn('{invalid') |
||
511 | ; |
||
512 | |||
513 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
514 | $bowerphp->updatePackage($package, $installer); |
||
515 | } |
||
516 | |||
517 | public function testUpdateDependenciesWithNewPackageToInstall() |
||
518 | { |
||
519 | $this->mockLookups('jquery', 'jquery-ui', '{"name":"jquery","url":"git://github.com/jquery/jquery.git"}', '{"name":"jquery-ui","url":"git://github.com/components/jquery-ui.git"}'); |
||
520 | |||
521 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
522 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
523 | |||
524 | $this->config |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
525 | ->shouldReceive('getBowerFileContent')->andReturn(['dependencies' => ['jquery-ui' => '*']]) |
||
526 | ; |
||
527 | |||
528 | $bowerJsonJqueryUI = '{"name":"jquery-ui","version":"1.10.1", "main":"jquery-ui.js","dependencies":{"jquery":"*"}}'; |
||
529 | $bowerJsonJquery = '{"name":"jquery","version":"2.0.3", "main":"jquery.js"}'; |
||
530 | |||
531 | $package |
||
532 | ->shouldReceive('getName')->andReturn('jquery-ui', 'jquery') |
||
533 | ->shouldReceive('getRequiredVersion')->andReturn('*', '*') |
||
534 | ->shouldReceive('setRepository')->with($this->repository) |
||
535 | ->shouldReceive('setInfo') |
||
536 | ->shouldReceive('setVersion') |
||
537 | ; |
||
538 | |||
539 | $this->filesystem |
||
540 | ->shouldReceive('write')->with('./tmp/jquery-ui', 'fileAsString...') |
||
541 | ->shouldReceive('write')->with('./tmp/jquery', 'fileAsString...') |
||
542 | ->shouldReceive('write')->with(getcwd() . '/bower_components/jquery-ui/.bower.json', '{"name":"jquery-ui","version":"1.10.1"}') |
||
543 | ->shouldReceive('write')->with(getcwd() . '/bower_components/jquery/.bower.json', '{"name":"jquery","version":"2.0.3"}') |
||
544 | ; |
||
545 | |||
546 | $this->repository |
||
547 | ->shouldReceive('findPackage')->with('*')->andReturn('1.10.1', '2.0.3') |
||
548 | ; |
||
549 | |||
550 | $this->repository |
||
551 | ->shouldReceive('setUrl->setHttpClient'); |
||
552 | $this->repository |
||
553 | ->shouldReceive('getBower')->andReturn($bowerJsonJqueryUI, $bowerJsonJquery) |
||
554 | ->shouldReceive('getRelease')->andReturn('fileAsString...') |
||
555 | ; |
||
556 | |||
557 | $this->output |
||
0 ignored issues
–
show
|
|||
558 | ->shouldReceive('writelnInfoPackage') |
||
559 | ->shouldReceive('writelnInstalledPackage') |
||
560 | ->shouldReceive('writelnUpdatingPackage') |
||
561 | ; |
||
562 | $this->config |
||
563 | ->shouldReceive('getOverridesSection')->andReturn([]) |
||
564 | ->shouldReceive('getOverrideFor')->andReturn([]) |
||
565 | ->shouldReceive('isSaveToBowerJsonFile')->andReturn(false) |
||
566 | ->shouldReceive('getPackageBowerFileContent')->andReturn(['name' => 'jquery-ui', 'version' => '1.10.0']) |
||
567 | ; |
||
568 | |||
569 | $installer |
||
570 | ->shouldReceive('update') |
||
571 | ->shouldReceive('install') |
||
572 | ; |
||
573 | |||
574 | $package |
||
575 | ->shouldReceive('setRequiredVersion') |
||
576 | ->shouldReceive('setRequires') |
||
577 | ->shouldReceive('getVersion')->andReturn('1.10.0') |
||
578 | ; |
||
579 | |||
580 | $this->filesystem |
||
581 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery-ui/.bower.json')->andReturn(true) |
||
582 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery/.bower.json')->andReturn(false) |
||
583 | ->shouldReceive('read')->with(getcwd() . '/bower_components/jquery-ui/.bower.json')->andReturn('{"name":"jquery-ui","version":"1.10.0"}') |
||
584 | ->shouldReceive('write')->with('./tmp/jquery-ui', 'fileAsString...') |
||
585 | ->shouldReceive('write')->with('./tmp/jquery', 'fileAsString...') |
||
586 | ->shouldReceive('write')->with(getcwd() . '/bower_components/jquery-ui/.bower.json', '{"name":"jquery-ui","version":"1.10.1"}') |
||
587 | ->shouldReceive('write')->with(getcwd() . '/bower_components/jquery/.bower.json', '{"name":"jquery","version":"2.0.3"}') |
||
588 | ; |
||
589 | |||
590 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
591 | $bowerphp->updatePackages($installer); |
||
592 | } |
||
593 | |||
594 | public function testUpdateDependencies() |
||
595 | { |
||
596 | $this->mockLookup(); |
||
597 | |||
598 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
599 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
600 | |||
601 | $this->config |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
602 | ->shouldReceive('getBowerFileContent')->andReturn(['dependencies' => ['jquery' => '*']]) |
||
603 | ; |
||
604 | |||
605 | $this->installPackage($package, $installer, ['jquery'], ['2.0.1'], ['*'], true, ['2.0.3']); |
||
606 | |||
607 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
608 | $bowerphp->updatePackages($installer); |
||
609 | } |
||
610 | |||
611 | /** |
||
612 | * @expectedException \RuntimeException |
||
613 | * @expectedExceptionMessage Malformed JSON |
||
614 | */ |
||
615 | public function testUpdatePackageWithMalformedBowerJsonContent() |
||
616 | { |
||
617 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
618 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
619 | |||
620 | $packageJson = '{"name":"less","version":"1.2.1"}'; |
||
621 | $json = '{"invalid json'; |
||
622 | |||
623 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
624 | ->shouldReceive('getName')->andReturn('less') |
||
625 | ->shouldReceive('getRequiredVersion')->andReturn(null, '*') |
||
626 | ->shouldReceive('getVersion')->andReturn('1.2.1') |
||
627 | ->shouldReceive('setInfo') |
||
628 | ->shouldReceive('setRequires')->with(null) |
||
629 | ->shouldReceive('setRequiredVersion')->with('*') |
||
630 | ->shouldReceive('setVersion')->with('1.2.1') |
||
631 | ; |
||
632 | |||
633 | $this->config |
||
634 | ->shouldReceive('getBowerFileContent')->andThrow(new RuntimeException(sprintf('Malformed JSON'))) |
||
635 | ; |
||
636 | |||
637 | $this->filesystem |
||
638 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/less/.bower.json')->andReturn(true) |
||
639 | ->shouldReceive('read')->with(getcwd() . '/bower_components/less/.bower.json')->andReturn($packageJson) |
||
640 | ; |
||
641 | |||
642 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
643 | $bowerphp->updatePackage($package, $installer); |
||
644 | } |
||
645 | |||
646 | /** |
||
647 | * @expectedException \RuntimeException |
||
648 | * @expectedExceptionMessage Cannot find package colorbox version 2.*. |
||
649 | */ |
||
650 | public function testUpdatePackageVersionNotFound() |
||
651 | { |
||
652 | $this->mockLookup('colorbox', '{"name":"colorbox","url":"git://github.com/jackmoore/colorbox.git"}'); |
||
653 | |||
654 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
655 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
656 | |||
657 | $this->filesystem |
||
658 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/colorbox/.bower.json')->andReturn(true) |
||
659 | ; |
||
660 | |||
661 | $this->config |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
662 | ->shouldReceive('getPackageBowerFileContent')->andReturn(['name' => 'colorbox', 'version' => '1.0.0']) |
||
663 | ; |
||
664 | |||
665 | $package |
||
666 | ->shouldReceive('getName')->andReturn('colorbox') |
||
667 | ->shouldReceive('getRequiredVersion')->andReturn('2.*') |
||
668 | ->shouldReceive('setInfo')->with(['name' => 'colorbox', 'version' => '1.0.0']) |
||
669 | ->shouldReceive('setVersion')->with('1.0.0') |
||
670 | ->shouldReceive('setRequires')->with(null) |
||
671 | ; |
||
672 | |||
673 | $this->repository |
||
674 | ->shouldReceive('setUrl->setHttpClient'); |
||
675 | $this->repository |
||
676 | ->shouldReceive('getBower')->andReturn('{"name":"colorbox"}') |
||
677 | ->shouldReceive('findPackage')->andReturn(null) |
||
678 | ; |
||
679 | |||
680 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
681 | $bowerphp->updatePackage($package, $installer); |
||
682 | } |
||
683 | |||
684 | public function testGetPackageInfo() |
||
685 | { |
||
686 | $this->mockLookup('colorbox', '{"name":"colorbox","url":"git://github.com/jackmoore/colorbox.git"}'); |
||
687 | |||
688 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
689 | $request = Mockery::mock('Guzzle\Http\Message\RequestInterface'); |
||
690 | |||
691 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
692 | ->shouldReceive('getName')->andReturn('colorbox') |
||
693 | ->shouldReceive('getRequiredVersion')->andReturn('1.1') |
||
694 | ; |
||
695 | |||
696 | $this->repository |
||
697 | ->shouldReceive('setHttpClient')->with($this->httpClient) |
||
698 | ->shouldReceive('getUrl')->andReturn('https://github.com/jackmoore/colorbox') |
||
699 | ->shouldReceive('setUrl')->with('git://github.com/jackmoore/colorbox.git', false) |
||
700 | ->shouldReceive('findPackage')->with('1.1')->andReturn('1.1.0') |
||
701 | ->shouldReceive('setUrl')->with('https://github.com/jackmoore/colorbox', true) |
||
702 | ->shouldReceive('getBower')->with('1.1.0', true, 'git://github.com/jackmoore/colorbox.git')->andReturn('a json...') |
||
703 | ->shouldReceive('getTags')->andReturn(['1.1.0', '1.0.0-rc1', '1.0.0', '1.0.0-beta']) |
||
704 | ; |
||
705 | |||
706 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
707 | |||
708 | $this->assertEquals('https://github.com/jackmoore/colorbox', $bowerphp->getPackageInfo($package)); |
||
709 | $this->assertEquals(['1.1.0', '1.0.0', '1.0.0-rc1', '1.0.0-beta'], $bowerphp->getPackageInfo($package, 'versions')); |
||
710 | |||
711 | //FIXME extract to another method |
||
712 | $this->assertEquals('a json...', $bowerphp->getPackageBowerFile($package)); |
||
713 | } |
||
714 | |||
715 | public function testReturnLookupForPackage() |
||
716 | { |
||
717 | $this->mockLookup('colorbox', '{"name":"colorbox","url":"git://github.com/jackmoore/colorbox.git"}'); |
||
718 | |||
719 | //given |
||
720 | //FIXME copy-paste from method BowerphpTest::testGetPackageInfo() extract to method |
||
721 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
722 | |||
723 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
724 | ->shouldReceive('getName')->andReturn('colorbox') |
||
725 | ->shouldReceive('getRequiredVersion')->andReturn('1.1') |
||
726 | ; |
||
727 | |||
728 | $this->repository |
||
729 | ->shouldReceive('setHttpClient')->with($this->httpClient) |
||
730 | ->shouldReceive('getUrl')->andReturn('https://github.com/jackmoore/colorbox') |
||
731 | ->shouldReceive('setUrl')->with('git://github.com/jackmoore/colorbox.git', false) |
||
732 | ->shouldReceive('findPackage')->with('1.1')->andReturn('1.1.0') |
||
733 | ->shouldReceive('setUrl')->with('https://github.com/jackmoore/colorbox', true) |
||
734 | ->shouldReceive('getBower')->with('1.1.0', true, 'git://github.com/jackmoore/colorbox.git')->andReturn('a json...') |
||
735 | ->shouldReceive('getTags')->andReturn(['1.1.0', '1.0.0']) |
||
736 | ; |
||
737 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
738 | |||
739 | //when |
||
740 | $package = $bowerphp->lookupPackage('colorbox'); |
||
741 | |||
742 | //then |
||
743 | $this->assertEquals('colorbox', $package['name']); |
||
744 | $this->assertEquals('git://github.com/jackmoore/colorbox.git', $package['url']); |
||
745 | } |
||
746 | |||
747 | public function testCreateAClearBowerFile() |
||
748 | { |
||
749 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
750 | $expected = ['name' => '', 'authors' => ['Beelab <[email protected]>', 'pippo'], 'private' => true, 'dependencies' => new \StdClass()]; |
||
751 | $method = $this->getMethod('Bowerphp\Bowerphp', 'createAClearBowerFile'); |
||
752 | $this->assertEquals($expected, $method->invokeArgs($bowerphp, [['name' => '', 'author' => 'pippo']])); |
||
753 | } |
||
754 | |||
755 | public function testSearchPackages() |
||
756 | { |
||
757 | $response = Mockery::mock('Guzzle\Http\Message\Response'); |
||
758 | $guzzle = Mockery::mock('Github\HttpClient\HttpClientInterface'); |
||
759 | |||
760 | $packagesJson = '[{"name":"jquery","url":"git://github.com/jquery/jquery.git"},{"name":"jquery-ui","url":"git://github.com/components/jqueryui"}]'; |
||
761 | |||
762 | $this->httpClient |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
763 | ->shouldReceive('getHttpClient')->andReturn($guzzle) |
||
764 | ; |
||
765 | |||
766 | $guzzle |
||
767 | ->shouldReceive('get')->with('http://bower.herokuapp.com/packages/search/jquery')->andReturn($response) |
||
768 | ; |
||
769 | $response |
||
770 | ->shouldReceive('getBody')->andReturn($packagesJson) |
||
771 | ; |
||
772 | |||
773 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
774 | $this->assertEquals(json_decode($packagesJson, true), $bowerphp->searchPackages('jquery')); |
||
775 | } |
||
776 | |||
777 | /** |
||
778 | * @expectedException \RuntimeException |
||
779 | * @expectedExceptionMessage Cannot get package list from http://bower.herokuapp.com. |
||
780 | */ |
||
781 | public function testSearchPackagesException() |
||
782 | { |
||
783 | $guzzle = Mockery::mock('Github\HttpClient\HttpClientInterface'); |
||
784 | |||
785 | $this->httpClient |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
786 | ->shouldReceive('getHttpClient')->andReturn($guzzle) |
||
787 | ; |
||
788 | |||
789 | $this->config |
||
790 | ->shouldReceive('getBasePackagesUrl')->andReturn('http://example.com') |
||
791 | ; |
||
792 | |||
793 | $guzzle |
||
794 | ->shouldReceive('get')->with('http://bower.herokuapp.com/packages/search/jquery')->andThrow(new RequestException()) |
||
795 | ; |
||
796 | |||
797 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
798 | $bowerphp->searchPackages('jquery'); |
||
799 | } |
||
800 | |||
801 | public function testGetInstalledPackages() |
||
802 | { |
||
803 | $packages = ['a', 'b', 'c']; |
||
804 | $finder = Mockery::mock('Symfony\Component\Finder\Finder'); |
||
805 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
806 | |||
807 | $installer |
||
808 | ->shouldReceive('getInstalled')->with($finder)->andReturn($packages) |
||
809 | ; |
||
810 | |||
811 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
812 | $this->assertEquals($packages, $bowerphp->getInstalledPackages($installer, $finder)); |
||
813 | } |
||
814 | |||
815 | public function testInstallPackageWithDependenciesToInstall() |
||
816 | { |
||
817 | $this->mockLookups('jquery', 'jquery-ui', '{"name":"jquery","url":"git://github.com/jquery/jquery.git"}', '{"name":"jquery-ui","url":"git://github.com/components/jquery-ui.git"}'); |
||
818 | |||
819 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
820 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
821 | |||
822 | $bowerJsonJqueryUI = '{"name":"jquery-ui","version":"1.10.1", "main":"jquery-ui.js","dependencies":{"jquery":"*"}}'; |
||
823 | $bowerJsonJquery = '{"name":"jquery","version":"2.0.3", "main":"jquery.js"}'; |
||
824 | |||
825 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
826 | ->shouldReceive('getName')->andReturn('jquery-ui', 'jquery') |
||
827 | ->shouldReceive('getRequiredVersion')->andReturn('*', '*') |
||
828 | ->shouldReceive('setRepository')->with($this->repository) |
||
829 | ->shouldReceive('setInfo') |
||
830 | ->shouldReceive('setVersion') |
||
831 | ->shouldReceive('setRequiredVersion') |
||
832 | ->shouldReceive('setRequires') |
||
833 | ->shouldReceive('getVersion')->andReturn('1.10.0') |
||
834 | ->shouldReceive('getRequires') |
||
835 | ; |
||
836 | |||
837 | $this->filesystem |
||
838 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery-ui/.bower.json')->andReturn(false) |
||
839 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery/.bower.json')->andReturn(false) |
||
840 | ->shouldReceive('write')->with('./tmp/jquery-ui', 'fileAsString...') |
||
841 | ->shouldReceive('write')->with('./tmp/jquery', 'fileAsString...') |
||
842 | ->shouldReceive('write')->with(getcwd() . '/bower_components/jquery-ui/.bower.json', '{"name":"jquery-ui","version":"1.10.1"}') |
||
843 | ->shouldReceive('write')->with(getcwd() . '/bower_components/jquery/.bower.json', '{"name":"jquery","version":"2.0.3"}') |
||
844 | ; |
||
845 | |||
846 | $this->repository |
||
847 | ->shouldReceive('findPackage')->with('*')->andReturn('1.10.1', '2.0.3') |
||
848 | ; |
||
849 | |||
850 | $this->repository |
||
851 | ->shouldReceive('setUrl->setHttpClient'); |
||
852 | $this->repository |
||
853 | ->shouldReceive('getBower')->andReturn($bowerJsonJqueryUI, $bowerJsonJquery) |
||
854 | ->shouldReceive('getRelease')->andReturn('fileAsString...') |
||
855 | ; |
||
856 | |||
857 | $this->output |
||
0 ignored issues
–
show
|
|||
858 | ->shouldReceive('writelnInfoPackage') |
||
859 | ->shouldReceive('writelnInstalledPackage') |
||
860 | ; |
||
861 | $this->config |
||
862 | ->shouldReceive('getOverridesSection')->andReturn([]) |
||
863 | ->shouldReceive('getOverrideFor')->andReturn([]) |
||
864 | ->shouldReceive('isSaveToBowerJsonFile')->andReturn(false) |
||
865 | ; |
||
866 | |||
867 | $installer |
||
868 | ->shouldReceive('install') |
||
869 | ; |
||
870 | |||
871 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
872 | $bowerphp->installPackage($package, $installer); |
||
873 | } |
||
874 | |||
875 | public function testInstallPackageWithDependenciesToUpdate() |
||
876 | { |
||
877 | $this->mockLookups('jquery', 'jquery-ui', '{"name":"jquery","url":"git://github.com/jquery/jquery.git"}', '{"name":"jquery-ui","url":"git://github.com/components/jquery-ui.git"}'); |
||
878 | |||
879 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
880 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
881 | |||
882 | $bowerJsonJqueryUI = '{"name":"jquery-ui","version":"1.10.1", "main":"jquery-ui.js","dependencies":{"jquery":"2.*"}}'; |
||
883 | $bowerJsonJquery = '{"name":"jquery","version":"2.0.3", "main":"jquery.js"}'; |
||
884 | |||
885 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
886 | ->shouldReceive('getName')->andReturn('jquery-ui', 'jquery') |
||
887 | ->shouldReceive('getRequiredVersion')->andReturn('*', '2.*') |
||
888 | ->shouldReceive('setRepository')->with($this->repository) |
||
889 | ->shouldReceive('setInfo') |
||
890 | ->shouldReceive('setVersion') |
||
891 | ->shouldReceive('setRequiredVersion') |
||
892 | ->shouldReceive('setRequires') |
||
893 | ->shouldReceive('getVersion')->andReturn('1.10.0', '1.0.0') |
||
894 | ->shouldReceive('getRequires') |
||
895 | ; |
||
896 | |||
897 | $this->filesystem |
||
898 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery-ui/.bower.json')->andReturn(false) |
||
899 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery/.bower.json')->andReturn(true) |
||
900 | ->shouldReceive('write')->with('./tmp/jquery-ui', 'fileAsString...') |
||
901 | ->shouldReceive('write')->with('./tmp/jquery', 'fileAsString...') |
||
902 | ->shouldReceive('write')->with(getcwd() . '/bower_components/jquery-ui/.bower.json', '{"name":"jquery-ui","version":"1.10.1"}') |
||
903 | ->shouldReceive('write')->with(getcwd() . '/bower_components/jquery/.bower.json', '{"name":"jquery","version":"2.0.3"}') |
||
904 | ; |
||
905 | |||
906 | $this->repository |
||
907 | ->shouldReceive('findPackage')->with('*')->andReturn('1.10.1') |
||
908 | ->shouldReceive('findPackage')->with('2.*')->andReturn('2.0.3') |
||
909 | ; |
||
910 | |||
911 | $this->repository |
||
912 | ->shouldReceive('setUrl->setHttpClient'); |
||
913 | $this->repository |
||
914 | ->shouldReceive('getBower')->andReturn($bowerJsonJqueryUI, $bowerJsonJquery) |
||
915 | ->shouldReceive('getRelease')->andReturn('fileAsString...') |
||
916 | ; |
||
917 | |||
918 | $this->output |
||
0 ignored issues
–
show
|
|||
919 | ->shouldReceive('writelnInfoPackage') |
||
920 | ->shouldReceive('writelnInstalledPackage') |
||
921 | ; |
||
922 | |||
923 | $this->config |
||
924 | ->shouldReceive('getOverridesSection')->andReturn([]) |
||
925 | ->shouldReceive('getOverrideFor')->andReturn([]) |
||
926 | ->shouldReceive('isSaveToBowerJsonFile')->andReturn(false) |
||
927 | ->shouldReceive('getPackageBowerFileContent')->andReturn(['name' => 'jquery', 'version' => '1.0.0']) |
||
928 | ->shouldReceive('getBowerFileContent')->andReturn([]) |
||
929 | ; |
||
930 | |||
931 | $installer |
||
932 | ->shouldReceive('install') |
||
933 | ->shouldReceive('update') |
||
934 | ; |
||
935 | |||
936 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
937 | $bowerphp->installPackage($package, $installer); |
||
938 | } |
||
939 | |||
940 | /** |
||
941 | * @expectedException \RuntimeException |
||
942 | * @expectedExceptionMessage Registry info for package colorbox has malformed json or is missing "url". |
||
943 | */ |
||
944 | public function testInstallPackageJsonException() |
||
945 | { |
||
946 | $this->mockLookup('colorbox', '{invalid'); |
||
947 | |||
948 | $request = Mockery::mock('Guzzle\Http\Message\RequestInterface'); |
||
949 | $response = Mockery::mock('Guzzle\Http\Message\Response'); |
||
950 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
951 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
952 | |||
953 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
954 | ->shouldReceive('getName')->andReturn('colorbox') |
||
955 | ; |
||
956 | |||
957 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
958 | $bowerphp->installPackage($package, $installer); |
||
959 | } |
||
960 | |||
961 | /** |
||
962 | * @expectedException \RuntimeException |
||
963 | * @expectedExceptionMessage Invalid bower.json found in package colorbox: {invalid. |
||
964 | */ |
||
965 | public function testInstallBowerJsonException() |
||
966 | { |
||
967 | $this->mockLookup('colorbox', '{"url":"http://example.org"}'); |
||
968 | |||
969 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
970 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
971 | |||
972 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
973 | ->shouldReceive('getName')->andReturn('colorbox') |
||
974 | ->shouldReceive('getRequiredVersion')->andReturn('1') |
||
975 | ; |
||
976 | |||
977 | $this->repository |
||
978 | ->shouldReceive('setUrl->setHttpClient'); |
||
979 | $this->repository |
||
980 | ->shouldReceive('findPackage')->with('1')->andReturn('1.0.0') |
||
981 | ->shouldReceive('getBower')->andReturn('{invalid') |
||
982 | ; |
||
983 | |||
984 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
985 | $bowerphp->installPackage($package, $installer); |
||
986 | } |
||
987 | |||
988 | /** |
||
989 | * @expectedException \RuntimeException |
||
990 | * @expectedExceptionMessage Cannot find package colorbox version *. |
||
991 | */ |
||
992 | public function testInstallPackageVersionNotFound() |
||
993 | { |
||
994 | $this->mockLookup('colorbox', '{"url":"http://example.org"}'); |
||
995 | |||
996 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
997 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
998 | |||
999 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
1000 | ->shouldReceive('getName')->andReturn('colorbox') |
||
1001 | ->shouldReceive('getRequiredVersion')->andReturn('*') |
||
1002 | ; |
||
1003 | |||
1004 | $this->repository |
||
1005 | ->shouldReceive('setUrl->setHttpClient'); |
||
1006 | $this->repository |
||
1007 | ->shouldReceive('getBower')->andReturn('{"name":"colorbox"}') |
||
1008 | ->shouldReceive('findPackage')->andReturn(null) |
||
1009 | ; |
||
1010 | |||
1011 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
1012 | $bowerphp->installPackage($package, $installer); |
||
1013 | } |
||
1014 | |||
1015 | public function testUpdateWithDependenciesToUpdate() |
||
1016 | { |
||
1017 | $this->mockLookups('jquery', 'jquery-ui', '{"name":"jquery","url":"git://github.com/jquery/jquery.git"}', '{"name":"jquery-ui","url":"git://github.com/components/jquery-ui.git"}'); |
||
1018 | |||
1019 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
1020 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
1021 | |||
1022 | $bowerJsonJqueryUI = '{"name":"jquery-ui","version":"1.10.1", "main":"jquery-ui.js","dependencies":{"jquery":"*"}}'; |
||
1023 | $bowerJsonJquery = '{"name":"jquery","version":"2.0.3", "main":"jquery.js"}'; |
||
1024 | |||
1025 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
1026 | ->shouldReceive('getName')->andReturn('jquery-ui', 'jquery') |
||
1027 | ->shouldReceive('getRequiredVersion')->andReturn('*', '*') |
||
1028 | ->shouldReceive('setRepository')->with($this->repository) |
||
1029 | ->shouldReceive('setInfo') |
||
1030 | ->shouldReceive('setVersion') |
||
1031 | ->shouldReceive('setRequiredVersion') |
||
1032 | ->shouldReceive('setRequires') |
||
1033 | ->shouldReceive('getRequires')->andReturn(['jquery' => '*']) |
||
1034 | ->shouldReceive('getVersion')->andReturn('1.10.0' . '2.0.1') |
||
1035 | ; |
||
1036 | |||
1037 | $this->filesystem |
||
1038 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery-ui/.bower.json')->andReturn(true) |
||
1039 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery/.bower.json')->andReturn(true) |
||
1040 | ->shouldReceive('write')->with('./tmp/jquery-ui', 'fileAsString...') |
||
1041 | ->shouldReceive('write')->with('./tmp/jquery', 'fileAsString...') |
||
1042 | ->shouldReceive('write')->with(getcwd() . '/bower_components/jquery-ui/.bower.json', '{"name":"jquery-ui","version":"1.10.1"}') |
||
1043 | ->shouldReceive('write')->with(getcwd() . '/bower_components/jquery/.bower.json', '{"name":"jquery","version":"2.0.3"}') |
||
1044 | ; |
||
1045 | |||
1046 | $this->repository |
||
1047 | ->shouldReceive('findPackage')->with('*')->andReturn('1.10.1', '2.0.3') |
||
1048 | ; |
||
1049 | |||
1050 | $this->repository |
||
1051 | ->shouldReceive('setUrl->setHttpClient'); |
||
1052 | $this->repository |
||
1053 | ->shouldReceive('getBower')->andReturn($bowerJsonJqueryUI, $bowerJsonJquery) |
||
1054 | ->shouldReceive('getRelease')->andReturn('fileAsString...') |
||
1055 | ; |
||
1056 | |||
1057 | $this->output |
||
0 ignored issues
–
show
|
|||
1058 | ->shouldReceive('writelnInfoPackage') |
||
1059 | ->shouldReceive('writelnInstalledPackage') |
||
1060 | ->shouldReceive('writelnUpdatingPackage') |
||
1061 | ; |
||
1062 | $this->config |
||
1063 | ->shouldReceive('getOverridesSection')->andReturn([]) |
||
1064 | ->shouldReceive('getOverrideFor')->andReturn([]) |
||
1065 | ->shouldReceive('isSaveToBowerJsonFile')->andReturn(false) |
||
1066 | ->shouldReceive('getPackageBowerFileContent')->andReturn(['name' => 'jquery-ui', 'version' => '1.10.0'], ['name' => 'jquery', 'version' => '2.0.1']) |
||
1067 | ; |
||
1068 | |||
1069 | $installer |
||
1070 | ->shouldReceive('update') |
||
1071 | ; |
||
1072 | |||
1073 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
1074 | $bowerphp->updatePackage($package, $installer); |
||
1075 | } |
||
1076 | |||
1077 | /** |
||
1078 | * @expectedException \RuntimeException |
||
1079 | * @expectedExceptionMessage Package jquery is not installed. |
||
1080 | */ |
||
1081 | public function testUpdateUninstalledPackage() |
||
1082 | { |
||
1083 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
1084 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
1085 | |||
1086 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
1087 | ->shouldReceive('getName')->andReturn('jquery') |
||
1088 | ; |
||
1089 | |||
1090 | $this->filesystem |
||
1091 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery/.bower.json')->andReturn(false) |
||
1092 | ; |
||
1093 | |||
1094 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
1095 | $bowerphp->updatePackage($package, $installer); |
||
1096 | } |
||
1097 | |||
1098 | public function testUpdateWithDependenciesToInstall() |
||
1099 | { |
||
1100 | $this->mockLookups('jquery', 'jquery-ui', '{"name":"jquery","url":"git://github.com/jquery/jquery.git"}', '{"name":"jquery-ui","url":"git://github.com/components/jquery-ui.git"}'); |
||
1101 | |||
1102 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
1103 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
1104 | |||
1105 | $bowerJsonJqueryUI = '{"name":"jquery-ui","version":"1.10.1", "main":"jquery-ui.js","dependencies":{"jquery":"*"}}'; |
||
1106 | $bowerJsonJquery = '{"name":"jquery","version":"2.0.3", "main":"jquery.js"}'; |
||
1107 | |||
1108 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
1109 | ->shouldReceive('getName')->andReturn('jquery-ui', 'jquery') |
||
1110 | ->shouldReceive('getRequiredVersion')->andReturn('*', '*') |
||
1111 | ->shouldReceive('setRepository')->with($this->repository) |
||
1112 | ->shouldReceive('setInfo') |
||
1113 | ->shouldReceive('setVersion') |
||
1114 | ->shouldReceive('setRequiredVersion') |
||
1115 | ->shouldReceive('setRequires') |
||
1116 | ->shouldReceive('getRequires')->andReturn(['jquery' => '*']) |
||
1117 | ->shouldReceive('getVersion')->andReturn('1.10.0') |
||
1118 | ; |
||
1119 | |||
1120 | $this->filesystem |
||
1121 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery-ui/.bower.json')->andReturn(true) |
||
1122 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery/.bower.json')->andReturn(false) |
||
1123 | ->shouldReceive('write')->with('./tmp/jquery-ui', 'fileAsString...') |
||
1124 | ->shouldReceive('write')->with('./tmp/jquery', 'fileAsString...') |
||
1125 | ->shouldReceive('write')->with(getcwd() . '/bower_components/jquery-ui/.bower.json', '{"name":"jquery-ui","version":"1.10.1"}') |
||
1126 | ->shouldReceive('write')->with(getcwd() . '/bower_components/jquery/.bower.json', '{"name":"jquery","version":"2.0.3"}') |
||
1127 | ; |
||
1128 | |||
1129 | $this->repository |
||
1130 | ->shouldReceive('findPackage')->with('*')->andReturn('1.10.1', '2.0.3') |
||
1131 | ; |
||
1132 | $this->repository |
||
1133 | ->shouldReceive('setUrl->setHttpClient'); |
||
1134 | $this->repository |
||
1135 | ->shouldReceive('getBower')->andReturn($bowerJsonJqueryUI, $bowerJsonJquery) |
||
1136 | ->shouldReceive('getRelease')->andReturn('fileAsString...') |
||
1137 | ; |
||
1138 | |||
1139 | $this->output |
||
0 ignored issues
–
show
|
|||
1140 | ->shouldReceive('writelnInfoPackage') |
||
1141 | ->shouldReceive('writelnInstalledPackage') |
||
1142 | ->shouldReceive('writelnUpdatingPackage') |
||
1143 | ; |
||
1144 | $this->config |
||
1145 | ->shouldReceive('getOverridesSection')->andReturn([]) |
||
1146 | ->shouldReceive('getOverrideFor')->andReturn([]) |
||
1147 | ->shouldReceive('isSaveToBowerJsonFile')->andReturn(false) |
||
1148 | ->shouldReceive('getPackageBowerFileContent')->andReturn(['name' => 'jquery-ui', 'version' => '1.10.0'], ['name' => 'jquery', 'version' => '2.0.1']) |
||
1149 | ; |
||
1150 | |||
1151 | $installer |
||
1152 | ->shouldReceive('update') |
||
1153 | ->shouldReceive('install') |
||
1154 | ; |
||
1155 | |||
1156 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
1157 | $bowerphp->updatePackage($package, $installer); |
||
1158 | } |
||
1159 | |||
1160 | /** |
||
1161 | * @expectedException \RuntimeException |
||
1162 | * @expectedExceptionMessage Unsupported info option "baz" |
||
1163 | */ |
||
1164 | public function testGetPackageInfoInvalidInfo() |
||
1165 | { |
||
1166 | $this->mockLookup('colorbox', '{"name":"colorbox","url":"git://github.com/jackmoore/colorbox.git"}'); |
||
1167 | |||
1168 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
1169 | $request = Mockery::mock('Guzzle\Http\Message\RequestInterface'); |
||
1170 | $response = Mockery::mock('Guzzle\Http\Message\Response'); |
||
1171 | |||
1172 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
1173 | ->shouldReceive('getName')->andReturn('colorbox') |
||
1174 | ->shouldReceive('getRequiredVersion')->andReturn('1.1') |
||
1175 | ; |
||
1176 | |||
1177 | $this->repository |
||
1178 | ->shouldReceive('setHttpClient')->with($this->httpClient) |
||
1179 | ; |
||
1180 | |||
1181 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
1182 | $bowerphp->getPackageInfo($package, 'baz'); |
||
1183 | } |
||
1184 | |||
1185 | /** |
||
1186 | * @expectedException \RuntimeException |
||
1187 | * @expectedExceptionMessage Registry info for package colorbox has malformed json or is missing "url". |
||
1188 | */ |
||
1189 | public function testGetPackageInfoJsonException() |
||
1190 | { |
||
1191 | $this->mockLookup('colorbox', '{invalid'); |
||
1192 | |||
1193 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
1194 | |||
1195 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
1196 | ->shouldReceive('getName')->andReturn('colorbox') |
||
1197 | ; |
||
1198 | |||
1199 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
1200 | $bowerphp->getPackageInfo($package); |
||
1201 | } |
||
1202 | |||
1203 | public function testIsPackageInstalled() |
||
1204 | { |
||
1205 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
1206 | |||
1207 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
1208 | ->shouldReceive('getName')->andReturn('colorbox') |
||
1209 | ; |
||
1210 | |||
1211 | $this->filesystem |
||
1212 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/colorbox/.bower.json')->andReturn(true, false) |
||
1213 | ; |
||
1214 | |||
1215 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
1216 | $this->assertTrue($bowerphp->isPackageInstalled($package)); |
||
1217 | $this->assertFalse($bowerphp->isPackageInstalled($package)); |
||
1218 | } |
||
1219 | |||
1220 | public function testUninstallPackage() |
||
1221 | { |
||
1222 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
1223 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
1224 | |||
1225 | $installer |
||
1226 | ->shouldReceive('uninstall')->with($package) |
||
1227 | ; |
||
1228 | |||
1229 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
1230 | ->shouldReceive('getName')->andReturn('jquery') |
||
1231 | ; |
||
1232 | |||
1233 | $this->filesystem |
||
1234 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery/.bower.json')->andReturn(true) |
||
1235 | ; |
||
1236 | |||
1237 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
1238 | $bowerphp->uninstallPackage($package, $installer); |
||
1239 | } |
||
1240 | |||
1241 | /** |
||
1242 | * @expectedException \RuntimeException |
||
1243 | * @expectedExceptionMessage Package jquery is not installed. |
||
1244 | */ |
||
1245 | public function testUninstallUninstalledPackage() |
||
1246 | { |
||
1247 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
1248 | $installer = Mockery::mock('Bowerphp\Installer\InstallerInterface'); |
||
1249 | |||
1250 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
1251 | ->shouldReceive('getName')->andReturn('jquery') |
||
1252 | ; |
||
1253 | |||
1254 | $this->filesystem |
||
1255 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery/.bower.json')->andReturn(false) |
||
1256 | ; |
||
1257 | |||
1258 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
1259 | $bowerphp->uninstallPackage($package, $installer); |
||
1260 | } |
||
1261 | |||
1262 | public function testIsPackageExtraneous() |
||
1263 | { |
||
1264 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
1265 | |||
1266 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
1267 | ->shouldReceive('getName')->andReturn('jquery') |
||
1268 | ; |
||
1269 | |||
1270 | $this->config |
||
1271 | ->shouldReceive('getBowerFileContent')->andReturn([], ['dependencies' => ['jquery' => '*']]) |
||
1272 | ; |
||
1273 | |||
1274 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
1275 | $this->assertTrue($bowerphp->isPackageExtraneous($package)); |
||
1276 | $this->assertFalse($bowerphp->isPackageExtraneous($package)); |
||
1277 | } |
||
1278 | |||
1279 | public function testIsPackageExtraneousWithoutBowerJsonFile() |
||
1280 | { |
||
1281 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
1282 | |||
1283 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
1284 | ->shouldReceive('getName')->andReturn('jquery') |
||
1285 | ; |
||
1286 | |||
1287 | $this->config |
||
1288 | ->shouldReceive('getBowerFileContent')->andThrow(new RuntimeException()) |
||
1289 | ; |
||
1290 | |||
1291 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
1292 | $this->assertTrue($bowerphp->isPackageExtraneous($package)); |
||
1293 | } |
||
1294 | |||
1295 | public function testIsPackageExtraneousWithCheck() |
||
1296 | { |
||
1297 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
1298 | |||
1299 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
1300 | ->shouldReceive('getName')->andReturn('colorbox') |
||
1301 | ; |
||
1302 | |||
1303 | $this->filesystem |
||
1304 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/colorbox/.bower.json')->andReturn(false) |
||
1305 | ; |
||
1306 | |||
1307 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
1308 | $this->assertFalse($bowerphp->isPackageExtraneous($package, true)); |
||
1309 | } |
||
1310 | |||
1311 | public function testIsPackageExtraneousThirdLevelDeep() |
||
1312 | { |
||
1313 | $package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
||
1314 | |||
1315 | $jsons = [ |
||
1316 | '{"name":"dummyPackageDependentFromJqueryUI","dependencies":{"jquery-ui":"*"}}', |
||
1317 | '{"name":"jquery-ui","dependencies":{"jquery":"*"}}', |
||
1318 | ]; |
||
1319 | |||
1320 | $package |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
1321 | ->shouldReceive('getName')->andReturn('jquery') |
||
1322 | ; |
||
1323 | |||
1324 | $this->filesystem |
||
1325 | ->shouldReceive('read')->andReturnValues($jsons) |
||
1326 | ; |
||
1327 | |||
1328 | $this->config |
||
1329 | ->shouldReceive('getBowerFileContent')->andReturn(['dependencies' => ['dummyPackageDependentFromJqueryUI' => '*']]) |
||
1330 | ; |
||
1331 | |||
1332 | $bowerphp = new Bowerphp($this->config, $this->filesystem, $this->httpClient, $this->repository, $this->output); |
||
0 ignored issues
–
show
$this->output is of type string , but the function expects a object<Bowerphp\Output\BowerphpConsoleOutput> .
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);
![]() |
|||
1333 | $this->assertFalse($bowerphp->isPackageExtraneous($package)); |
||
1334 | } |
||
1335 | |||
1336 | /** |
||
1337 | * Set expectations for installation of packages |
||
1338 | * Note: all array parameters must match counts |
||
1339 | * |
||
1340 | * @param MockInterface $package mock of Package |
||
1341 | * @param MockInterface $installer mock of Installer |
||
1342 | * @param array $names names of packages |
||
1343 | * @param array $versions versions of packages |
||
1344 | * @param array $requires required versions of packages |
||
1345 | * @param bool $update if this is an update (instead of an install) |
||
1346 | * @param array $updateVersions updated versions of packages (after update) |
||
1347 | */ |
||
1348 | protected function installPackage(MockInterface $package, MockInterface $installer, array $names, array $versions, array $requires = ['*'], $update = false, array $updateVersions = []) |
||
1349 | { |
||
1350 | $request = Mockery::mock('Guzzle\Http\Message\RequestInterface'); |
||
1351 | $response = Mockery::mock('Guzzle\Http\Message\Response'); |
||
1352 | |||
1353 | $packageJsons = []; |
||
1354 | $bowerJsons = []; |
||
1355 | |||
1356 | foreach ($names as $k => $v) { |
||
1357 | $packageJsons[] = '{"name":"' . $names[$k] . '","url":"git://github.com/components/' . $names[$k] . '.git"}'; |
||
1358 | $bowerJsons[] = '{"name":"' . $names[$k] . '","version":"' . $versions[$k] . '", "main":"' . $names[$k] . '.js"}'; |
||
1359 | } |
||
1360 | |||
1361 | $package |
||
1362 | ->shouldReceive('getName')->andReturnValues($names) |
||
1363 | ->shouldReceive('getRequiredVersion')->andReturnValues($requires) |
||
1364 | ->shouldReceive('setRepository')->with($this->repository) |
||
1365 | ->shouldReceive('setInfo')/*->with(json_encode($bowerJson))*/ |
||
1366 | ->shouldReceive('setVersion')/*->with($versions)*/ |
||
1367 | ->shouldReceive('getRequires') |
||
1368 | ; |
||
1369 | |||
1370 | foreach ($names as $k => $v) { |
||
1371 | $this->filesystem |
||
1372 | ->shouldReceive('exists')->with(getcwd() . '/bower_components/' . $names[$k] . '/.bower.json')->andReturn($update) |
||
1373 | ->shouldReceive('write')->with('./tmp/' . $names[$k], 'fileAsString...') |
||
1374 | ->shouldReceive('write')->with(getcwd() . '/bower_components/' . $names[$k] . '/.bower.json', '{"name":"' . $names[$k] . '","version":"' . $versions[$k] . '"}') |
||
1375 | ; |
||
1376 | $this->httpClient |
||
1377 | ->shouldReceive('get')->with('http://bower.herokuapp.com/packages/' . $names[$k])->andReturn($request) |
||
1378 | ; |
||
1379 | $this->repository |
||
1380 | ->shouldReceive('findPackage')->with($requires[$k])->andReturn($versions[$k]) |
||
1381 | ; |
||
1382 | } |
||
1383 | |||
1384 | $request |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
1385 | ->shouldReceive('send')->andReturn($response) |
||
1386 | ; |
||
1387 | $response |
||
1388 | ->shouldReceive('getBody')->andReturnValues($packageJsons) |
||
1389 | ; |
||
1390 | |||
1391 | $this->repository |
||
1392 | ->shouldReceive('setUrl->setHttpClient'); |
||
1393 | $this->repository |
||
1394 | ->shouldReceive('getBower')->andReturnValues($bowerJsons) |
||
1395 | ->shouldReceive('getRelease')->andReturn('fileAsString...') |
||
1396 | ; |
||
1397 | |||
1398 | $this->output |
||
0 ignored issues
–
show
|
|||
1399 | ->shouldReceive('writelnInfoPackage') |
||
1400 | ->shouldReceive('writelnInstalledPackage') |
||
1401 | ; |
||
1402 | $this->config |
||
1403 | ->shouldReceive('getOverridesSection')->andReturn([]) |
||
1404 | ->shouldReceive('getOverrideFor')->andReturn([]) |
||
1405 | ->shouldReceive('isSaveToBowerJsonFile')->andReturn(false) |
||
1406 | ; |
||
1407 | |||
1408 | $installer |
||
1409 | ->shouldReceive('install') |
||
1410 | ; |
||
1411 | |||
1412 | if ($update) { |
||
1413 | $package |
||
1414 | ->shouldReceive('setRequiredVersion') |
||
1415 | ->shouldReceive('setRequires') |
||
1416 | ->shouldReceive('getVersion')->andReturnValues($versions) |
||
1417 | ; |
||
1418 | |||
1419 | foreach ($names as $k => $v) { |
||
1420 | $this->config |
||
1421 | ->shouldReceive('getPackageBowerFileContent')->andReturn(['name' => $names[$k], 'version' => $versions[$k]]) |
||
1422 | ; |
||
1423 | $this->filesystem |
||
1424 | ->shouldReceive('write')->with('./tmp/' . $names[$k], 'fileAsString...') |
||
1425 | ->shouldReceive('write')->with(getcwd() . '/bower_components/' . $names[$k] . '/.bower.json', '{"name":"' . $names[$k] . '","version":"' . $updateVersions[$k] . '"}') |
||
1426 | ; |
||
1427 | } |
||
1428 | } |
||
1429 | } |
||
1430 | |||
1431 | /** |
||
1432 | * Mock a package lookup |
||
1433 | * |
||
1434 | * @param string $lookedPackage |
||
1435 | * @param string $returnedJson |
||
1436 | */ |
||
1437 | protected function mockLookup($lookedPackage = 'jquery', $returnedJson = '{"name":"jquery","url":"git://github.com/jquery/jquery.git"}') |
||
1438 | { |
||
1439 | $response = Mockery::mock('Guzzle\Http\Message\Response'); |
||
1440 | $guzzle = Mockery::mock('Github\HttpClient\HttpClientInterface'); |
||
1441 | |||
1442 | $guzzle |
||
1443 | ->shouldReceive('get')->with('http://bower.herokuapp.com/packages/' . $lookedPackage)->andReturn($response) |
||
1444 | ; |
||
1445 | |||
1446 | $this->httpClient |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
1447 | ->shouldReceive('getHttpClient')->andReturn($guzzle) |
||
1448 | ; |
||
1449 | $response |
||
1450 | ->shouldReceive('getBody')->andReturn($returnedJson) |
||
1451 | ; |
||
1452 | } |
||
1453 | |||
1454 | /** |
||
1455 | * Mock a 2-packages lookup |
||
1456 | * |
||
1457 | * @param string $lookedPackage1 |
||
1458 | * @param string $lookedPackage2 |
||
1459 | * @param string $returnedJson1 |
||
1460 | * @param string $returnedJson2 |
||
1461 | */ |
||
1462 | protected function mockLookups($lookedPackage1, $lookedPackage2, $returnedJson1, $returnedJson2) |
||
1463 | { |
||
1464 | $response = Mockery::mock('Guzzle\Http\Message\Response'); |
||
1465 | $guzzle = Mockery::mock('Github\HttpClient\HttpClientInterface'); |
||
1466 | |||
1467 | $guzzle |
||
1468 | ->shouldReceive('get')->with('http://bower.herokuapp.com/packages/' . $lookedPackage1)->andReturn($response) |
||
1469 | ->shouldReceive('get')->with('http://bower.herokuapp.com/packages/' . $lookedPackage2)->andReturn($response) |
||
1470 | ; |
||
1471 | |||
1472 | $this->httpClient |
||
0 ignored issues
–
show
The method
andReturn does only exist in Mockery\ExpectationInterface , but not in Mockery\HigherOrderMessage .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
1473 | ->shouldReceive('getHttpClient')->andReturn($guzzle) |
||
1474 | ; |
||
1475 | |||
1476 | $response |
||
1477 | ->shouldReceive('getBody')->andReturn($returnedJson1, $returnedJson2) |
||
1478 | ; |
||
1479 | } |
||
1480 | } |
||
1481 |
The class complexity is the sum of the complexity of all methods. A very high value is usually an indication that your class does not follow the single reponsibility principle and does more than one job.
Some resources for further reading:
You can also find more detailed suggestions for refactoring in the “Code” section of your repository.