1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Bowerphp\Test\Installer; |
4
|
|
|
|
5
|
|
|
use Bowerphp\Installer\Installer; |
6
|
|
|
use Bowerphp\Test\BowerphpTestCase; |
7
|
|
|
use Mockery; |
8
|
|
|
|
9
|
|
|
class InstallerTest extends BowerphpTestCase |
10
|
|
|
{ |
11
|
|
|
protected $installer; |
12
|
|
|
|
13
|
|
|
protected $zipArchive; |
14
|
|
|
|
15
|
|
|
protected $config; |
16
|
|
|
|
17
|
|
|
protected function setUp() |
18
|
|
|
{ |
19
|
|
|
parent::setUp(); |
20
|
|
|
|
21
|
|
|
$this->zipArchive = Mockery::mock('Bowerphp\Util\ZipArchive'); |
22
|
|
|
$this->config = Mockery::mock('Bowerphp\Config\ConfigInterface'); |
23
|
|
|
|
24
|
|
|
$this->installer = new Installer($this->filesystem, $this->zipArchive, $this->config); |
|
|
|
|
25
|
|
|
|
26
|
|
|
$this->config |
|
|
|
|
27
|
|
|
->shouldReceive('getOverridesSection')->andReturn([]) |
28
|
|
|
->shouldReceive('getOverrideFor')->andReturn([]) |
29
|
|
|
->shouldReceive('getBasePackagesUrl')->andReturn('http://bower.herokuapp.com/packages/') |
30
|
|
|
->shouldReceive('getInstallDir')->andReturn(getcwd() . '/bower_components') |
31
|
|
|
->shouldReceive('getCacheDir')->andReturn('.') |
32
|
|
|
; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
public function testInstall() |
36
|
|
|
{ |
37
|
|
|
$package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
38
|
|
|
|
39
|
|
|
$package |
|
|
|
|
40
|
|
|
->shouldReceive('getName')->andReturn('jquery') |
41
|
|
|
->shouldReceive('getInfo')->andReturn(['name' => 'jquery', 'version' => '2.0.3']) |
42
|
|
|
->shouldReceive('getVersion')->andReturn('2.0.3') |
43
|
|
|
->shouldReceive('getRequiredVersion')->andReturn('2.0.3') |
44
|
|
|
; |
45
|
|
|
|
46
|
|
|
$this->zipArchive |
47
|
|
|
->shouldReceive('open')->with('./tmp/jquery')->andReturn(true) |
48
|
|
|
->shouldReceive('getNumFiles')->andReturn(1) |
49
|
|
|
->shouldReceive('getNameIndex')->with(0)->andReturn('jquery') |
50
|
|
|
->shouldReceive('statIndex')->andReturn(['name' => 'jquery/foo', 'size' => 10, 'mtime' => 1396303200]) |
51
|
|
|
->shouldReceive('getStream')->with('jquery/foo')->andReturn('foo content') |
52
|
|
|
->shouldReceive('close') |
53
|
|
|
; |
54
|
|
|
|
55
|
|
|
$json = '{ |
56
|
|
|
"name": "jquery", |
57
|
|
|
"version": "2.0.3" |
58
|
|
|
}'; |
59
|
|
|
|
60
|
|
|
$this->filesystem |
61
|
|
|
->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery/bower.json')->andReturn(false) |
62
|
|
|
->shouldReceive('write')->with(getcwd() . '/bower_components/jquery/foo', 'foo content') |
63
|
|
|
->shouldReceive('write')->with(getcwd() . '/bower_components/jquery/.bower.json', $json) |
64
|
|
|
->shouldReceive('touch')->with(getcwd() . '/bower_components/jquery/foo', 1396303200) |
65
|
|
|
; |
66
|
|
|
|
67
|
|
|
$this->installer->install($package); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function testUpdate() |
71
|
|
|
{ |
72
|
|
|
$package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
73
|
|
|
|
74
|
|
|
$package |
|
|
|
|
75
|
|
|
->shouldReceive('getName')->andReturn('jquery') |
76
|
|
|
->shouldReceive('getInfo')->andReturn(['name' => 'jquery', 'version' => '2.0.3']) |
77
|
|
|
->shouldReceive('getRequiredVersion')->andReturn('2.0.3') |
78
|
|
|
->shouldReceive('getVersion')->andReturn('2.0.3') |
79
|
|
|
; |
80
|
|
|
|
81
|
|
|
$this->zipArchive |
82
|
|
|
->shouldReceive('open')->with('./tmp/jquery')->andReturn(true) |
83
|
|
|
->shouldReceive('getNumFiles')->andReturn(1) |
84
|
|
|
->shouldReceive('getNameIndex')->with(0)->andReturn('') |
85
|
|
|
->shouldReceive('statIndex')->andReturn(['name' => 'jquery/foo', 'size' => 10, 'mtime' => 1396303200]) |
86
|
|
|
->shouldReceive('getStream')->with('jquery/foo')->andReturn('foo content') |
87
|
|
|
->shouldReceive('close') |
88
|
|
|
; |
89
|
|
|
|
90
|
|
|
$json = '{ |
91
|
|
|
"name": "jquery", |
92
|
|
|
"version": "2.0.3" |
93
|
|
|
}'; |
94
|
|
|
|
95
|
|
|
$this->filesystem |
96
|
|
|
->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery/bower.json')->andReturn(false) |
97
|
|
|
->shouldReceive('write')->with(getcwd() . '/bower_components/jquery/foo', 'foo content') |
98
|
|
|
->shouldReceive('write')->with(getcwd() . '/bower_components/jquery/.bower.json', $json) |
99
|
|
|
->shouldReceive('touch')->with(getcwd() . '/bower_components/jquery/foo', 1396303200) |
100
|
|
|
; |
101
|
|
|
|
102
|
|
|
$this->installer->update($package); |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
public function testInstallAndMergeInfoWithBowerJsonContents() |
106
|
|
|
{ |
107
|
|
|
$package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
108
|
|
|
|
109
|
|
|
$info = [ |
110
|
|
|
'name' => 'jquery-ui', |
111
|
|
|
'version' => '1.12.1', |
112
|
|
|
'dependencies' => [ |
113
|
|
|
'jquery' => '>=1.6', |
114
|
|
|
], |
115
|
|
|
]; |
116
|
|
|
|
117
|
|
|
$package |
|
|
|
|
118
|
|
|
->shouldReceive('getName')->andReturn('jquery-ui') |
119
|
|
|
->shouldReceive('getVersion')->andReturn('1.12.1') |
120
|
|
|
->shouldReceive('getInfo')->andReturn([])->once() |
121
|
|
|
->shouldReceive('setInfo')->with($info)->andReturnSelf() |
122
|
|
|
->shouldReceive('getInfo')->andReturn($info); |
123
|
|
|
|
124
|
|
|
$json = '{ |
125
|
|
|
"name": "jquery-ui", |
126
|
|
|
"version": "1.12.1", |
127
|
|
|
"dependencies": { |
128
|
|
|
"jquery": ">=1.6" |
129
|
|
|
} |
130
|
|
|
}'; |
131
|
|
|
|
132
|
|
|
$this->zipArchive |
133
|
|
|
->shouldReceive('open')->with('./tmp/jquery-ui')->andReturn(true) |
134
|
|
|
->shouldReceive('getNumFiles')->andReturn(1) |
135
|
|
|
->shouldReceive('getNameIndex')->with(0)->andReturn('jquery-ui') |
136
|
|
|
->shouldReceive('statIndex')->andReturn(['name' => 'jquery-ui/bower.json', 'size' => 107, 'mtime' => 1483795099]) |
137
|
|
|
->shouldReceive('getStream')->with('jquery-ui/bower.json')->andReturn($json) |
138
|
|
|
->shouldReceive('close'); |
139
|
|
|
|
140
|
|
|
$this->filesystem |
141
|
|
|
->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery-ui/bower.json')->andReturn(true) |
142
|
|
|
->shouldReceive('write')->with(getcwd() . '/bower_components/jquery-ui/.bower.json', $json) |
143
|
|
|
->shouldReceive('write')->with(getcwd() . '/bower_components/jquery-ui/bower.json', $json) |
144
|
|
|
->shouldReceive('touch')->with(getcwd() . '/bower_components/jquery-ui/bower.json', 1483795099) |
145
|
|
|
->shouldReceive('read')->with(getcwd() . '/bower_components/jquery-ui/bower.json')->andReturn($json) |
146
|
|
|
; |
147
|
|
|
|
148
|
|
|
$this->installer->install($package); |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* @expectedException \RuntimeException |
153
|
|
|
* @expectedExceptionMessage Unable to open zip file ./tmp/jquery. |
154
|
|
|
*/ |
155
|
|
|
public function testInstallZipOpenException() |
156
|
|
|
{ |
157
|
|
|
$package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
158
|
|
|
|
159
|
|
|
$package |
|
|
|
|
160
|
|
|
->shouldReceive('getName')->andReturn('jquery') |
161
|
|
|
; |
162
|
|
|
|
163
|
|
|
$this->zipArchive |
164
|
|
|
->shouldReceive('open')->with('./tmp/jquery')->andReturn(false) |
165
|
|
|
; |
166
|
|
|
|
167
|
|
|
$this->installer->install($package); |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* @expectedException \RuntimeException |
172
|
|
|
* @expectedExceptionMessage Unable to open zip file ./tmp/jquery. |
173
|
|
|
*/ |
174
|
|
|
public function testUpdateZipOpenException() |
175
|
|
|
{ |
176
|
|
|
$package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
177
|
|
|
|
178
|
|
|
$package |
|
|
|
|
179
|
|
|
->shouldReceive('getName')->andReturn('jquery') |
180
|
|
|
; |
181
|
|
|
|
182
|
|
|
$this->zipArchive |
183
|
|
|
->shouldReceive('open')->with('./tmp/jquery')->andReturn(false) |
184
|
|
|
; |
185
|
|
|
|
186
|
|
|
$this->installer->update($package); |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
public function testFilterZipFiles() |
190
|
|
|
{ |
191
|
|
|
$archive = Mockery::mock('Bowerphp\Util\ZipArchive'); |
192
|
|
|
$archive |
193
|
|
|
->shouldReceive('getNameIndex')->with(0)->andReturn('dir/') |
194
|
|
|
->shouldReceive('getNumFiles')->andReturn(12) |
195
|
|
|
->shouldReceive('statIndex')->times(12)->andReturn( |
196
|
|
|
['name' => 'dir/.foo', 'size' => 10], |
197
|
|
|
['name' => 'dir/foo', 'size' => 10], |
198
|
|
|
['name' => 'dir/foo.ext', 'size' => 12], |
199
|
|
|
['name' => 'dir/bar/foo.ext', 'size' => 13], |
200
|
|
|
['name' => 'dir/bar/anotherdir', 'size' => 13], |
201
|
|
|
['name' => 'dir/anotherdir', 'size' => 13], |
202
|
|
|
['name' => 'dir/_foo', 'size' => 3], |
203
|
|
|
['name' => 'dir/_fooz/bar', 'size' => 3], |
204
|
|
|
['name' => 'dir/filename', 'size' => 3], |
205
|
|
|
['name' => 'dir/okfile', 'size' => 3], |
206
|
|
|
['name' => 'dir/subdir/file', 'size' => 3], |
207
|
|
|
['name' => 'dir/zzdir/subdir/file', 'size' => 3] |
208
|
|
|
); |
209
|
|
|
$filterZipFiles = $this->getMethod('Bowerphp\Installer\Installer', 'filterZipFiles'); |
210
|
|
|
$ignore = ['**/.*', '_*', 'subdir', '/anotherdir', 'filename', '*.ext']; |
211
|
|
|
$expect = [ |
212
|
|
|
'dir/foo', |
213
|
|
|
'dir/bar/anotherdir', |
214
|
|
|
'dir/okfile', |
215
|
|
|
'dir/zzdir/subdir/file', |
216
|
|
|
]; |
217
|
|
|
$this->assertEquals($expect, $filterZipFiles->invokeArgs($this->installer, [$archive, $ignore])); |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
public function testUninstall() |
221
|
|
|
{ |
222
|
|
|
$package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
223
|
|
|
|
224
|
|
|
$package |
|
|
|
|
225
|
|
|
->shouldReceive('getName')->andReturn('jquery') |
226
|
|
|
; |
227
|
|
|
|
228
|
|
|
$this->filesystem |
229
|
|
|
->shouldReceive('exists')->with(getcwd() . '/bower_components/jquery/.bower.json')->andReturn(true) |
230
|
|
|
->shouldReceive('remove')->with(getcwd() . '/bower_components/jquery') |
231
|
|
|
; |
232
|
|
|
|
233
|
|
|
$this->installer->uninstall($package); |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
public function testGetInstalled() |
237
|
|
|
{ |
238
|
|
|
$finder = Mockery::mock('Symfony\Component\Finder\Finder'); |
239
|
|
|
|
240
|
|
|
$finder |
|
|
|
|
241
|
|
|
->shouldReceive('directories->in')->andReturn(['package1', 'package2']); |
242
|
|
|
|
243
|
|
|
$this->filesystem |
244
|
|
|
->shouldReceive('exists')->with(getcwd() . '/bower_components')->andReturn(true) |
245
|
|
|
->shouldReceive('exists')->with('package1/.bower.json')->andReturn(true) |
246
|
|
|
->shouldReceive('exists')->with('package2/.bower.json')->andReturn(true) |
247
|
|
|
->shouldReceive('read')->with('package1/.bower.json')->andReturn('{"name":"package1","version":"1.0.0"}') |
248
|
|
|
->shouldReceive('read')->with('package2/.bower.json')->andReturn('{"name":"package2","version":"1.2.3"}') |
249
|
|
|
; |
250
|
|
|
|
251
|
|
|
$this->assertCount(2, $this->installer->getInstalled($finder)); |
|
|
|
|
252
|
|
|
} |
253
|
|
|
|
254
|
|
|
public function testGetInstalledWithoutInstalledPackages() |
255
|
|
|
{ |
256
|
|
|
$finder = Mockery::mock('Symfony\Component\Finder\Finder'); |
257
|
|
|
|
258
|
|
|
$this->filesystem |
259
|
|
|
->shouldReceive('exists')->with(getcwd() . '/bower_components')->andReturn(false) |
260
|
|
|
; |
261
|
|
|
|
262
|
|
|
$this->assertEquals([], $this->installer->getInstalled($finder)); |
263
|
|
|
} |
264
|
|
|
|
265
|
|
|
/** |
266
|
|
|
* @expectedException \RuntimeException |
267
|
|
|
* @expectedExceptionMessage Invalid content in .bower.json for package package1. |
268
|
|
|
*/ |
269
|
|
|
public function testGetInstalledWithoutBowerJsonFile() |
270
|
|
|
{ |
271
|
|
|
$finder = Mockery::mock('Symfony\Component\Finder\Finder'); |
272
|
|
|
|
273
|
|
|
$finder |
|
|
|
|
274
|
|
|
->shouldReceive('directories->in')->andReturn(['package1']); |
275
|
|
|
|
276
|
|
|
$this->filesystem |
277
|
|
|
->shouldReceive('exists')->with(getcwd() . '/bower_components')->andReturn(true) |
278
|
|
|
->shouldReceive('exists')->with('package1/.bower.json')->andReturn(true) |
279
|
|
|
->shouldReceive('read')->with('package1/.bower.json')->andReturn(null) |
280
|
|
|
; |
281
|
|
|
|
282
|
|
|
$this->installer->getInstalled($finder); |
283
|
|
|
} |
284
|
|
|
|
285
|
|
|
public function testFindDependentPackages() |
286
|
|
|
{ |
287
|
|
|
$package = Mockery::mock('Bowerphp\Package\PackageInterface'); |
288
|
|
|
$finder = Mockery::mock('Symfony\Component\Finder\Finder'); |
289
|
|
|
|
290
|
|
|
$package |
|
|
|
|
291
|
|
|
->shouldReceive('getName')->andReturn('jquery') |
292
|
|
|
; |
293
|
|
|
|
294
|
|
|
$finder |
295
|
|
|
->shouldReceive('directories->in')->andReturn(['package1', 'package2']); |
296
|
|
|
|
297
|
|
|
$this->filesystem |
298
|
|
|
->shouldReceive('exists')->with(getcwd() . '/bower_components')->andReturn(true) |
299
|
|
|
->shouldReceive('exists')->with('package1/.bower.json')->andReturn(true) |
300
|
|
|
->shouldReceive('exists')->with('package2/.bower.json')->andReturn(true) |
301
|
|
|
->shouldReceive('read')->with('package1/.bower.json')->andReturn('{"name":"package1","version":"1.0.0","dependencies":{"jquery": ">=1.3.2"}}') |
302
|
|
|
->shouldReceive('read')->with('package2/.bower.json')->andReturn('{"name":"package2","version":"1.2.3","dependencies":{"jquery": ">=1.6"}}') |
303
|
|
|
; |
304
|
|
|
|
305
|
|
|
$packages = $this->installer->findDependentPackages($package, $finder); |
306
|
|
|
|
307
|
|
|
$this->assertCount(2, $packages); |
|
|
|
|
308
|
|
|
$this->assertArrayHasKey('>=1.3.2', $packages); |
309
|
|
|
$this->assertArrayHasKey('>=1.6', $packages); |
310
|
|
|
} |
311
|
|
|
|
312
|
|
|
/** |
313
|
|
|
* @dataProvider providerIgnored |
314
|
|
|
*/ |
315
|
|
|
public function testIsIgnored($filename) |
316
|
|
|
{ |
317
|
|
|
$ignore = [ |
318
|
|
|
'**/.*', |
319
|
|
|
'_*', |
320
|
|
|
'docs-assets', |
321
|
|
|
'examples', |
322
|
|
|
'/fonts', |
323
|
|
|
'/fontsWithSlash/', |
324
|
|
|
'js/tests', |
325
|
|
|
'CNAME', |
326
|
|
|
'CONTRIBUTING.md', |
327
|
|
|
'Gruntfile.js', |
328
|
|
|
'browserstack.json', |
329
|
|
|
'composer.json', |
330
|
|
|
'package.json', |
331
|
|
|
'*.html', |
332
|
|
|
]; |
333
|
|
|
|
334
|
|
|
$ignored = $this->installer->isIgnored($filename, $ignore, [], 'twbs-bootstrap-6d03173/'); |
335
|
|
|
$this->assertTrue($ignored); |
336
|
|
|
} |
337
|
|
|
|
338
|
|
|
/** |
339
|
|
|
* @dataProvider providerNotIgnored |
340
|
|
|
*/ |
341
|
|
|
public function testIsNotIgnored($filename) |
342
|
|
|
{ |
343
|
|
|
$ignore = [ |
344
|
|
|
'**/.*', |
345
|
|
|
'_*', |
346
|
|
|
'docs-assets', |
347
|
|
|
'examples', |
348
|
|
|
'/fonts', |
349
|
|
|
'js/tests', |
350
|
|
|
'CNAME', |
351
|
|
|
'CONTRIBUTING.md', |
352
|
|
|
'Gruntfile.js', |
353
|
|
|
'browserstack.json', |
354
|
|
|
'bower.json', |
355
|
|
|
'composer.json', |
356
|
|
|
'package.json', |
357
|
|
|
'*.html', |
358
|
|
|
]; |
359
|
|
|
$force = [ |
360
|
|
|
'bower.json', |
361
|
|
|
]; |
362
|
|
|
|
363
|
|
|
$ignored = $this->installer->isIgnored($filename, $ignore, $force, 'twbs-bootstrap-6d03173/'); |
364
|
|
|
$this->assertFalse($ignored); |
365
|
|
|
} |
366
|
|
|
|
367
|
|
|
public function providerIgnored() |
368
|
|
|
{ |
369
|
|
|
return [ |
370
|
|
|
['twbs-bootstrap-6d03173/.editorconfig'], |
371
|
|
|
['twbs-bootstrap-6d03173/.gitattributes'], |
372
|
|
|
['twbs-bootstrap-6d03173/.gitignore'], |
373
|
|
|
['twbs-bootstrap-6d03173/.travis.yml'], |
374
|
|
|
['twbs-bootstrap-6d03173/CNAME'], |
375
|
|
|
['twbs-bootstrap-6d03173/CONTRIBUTING.md'], |
376
|
|
|
['twbs-bootstrap-6d03173/Gruntfile.js'], |
377
|
|
|
['twbs-bootstrap-6d03173/_config.yml'], |
378
|
|
|
['twbs-bootstrap-6d03173/_includes/ads.html'], |
379
|
|
|
['twbs-bootstrap-6d03173/_includes/footer.html'], |
380
|
|
|
['twbs-bootstrap-6d03173/_includes/header.html'], |
381
|
|
|
['twbs-bootstrap-6d03173/_includes/nav-about.html'], |
382
|
|
|
['twbs-bootstrap-6d03173/_includes/nav-components.html'], |
383
|
|
|
['twbs-bootstrap-6d03173/_includes/nav-css.html'], |
384
|
|
|
['twbs-bootstrap-6d03173/_includes/nav-customize.html'], |
385
|
|
|
['twbs-bootstrap-6d03173/_includes/nav-getting-started.html'], |
386
|
|
|
['twbs-bootstrap-6d03173/_includes/nav-javascript.html'], |
387
|
|
|
['twbs-bootstrap-6d03173/_includes/nav-main.html'], |
388
|
|
|
['twbs-bootstrap-6d03173/_includes/old-bs-docs.html'], |
389
|
|
|
['twbs-bootstrap-6d03173/_includes/social-buttons.html'], |
390
|
|
|
['twbs-bootstrap-6d03173/_layouts/default.html'], |
391
|
|
|
['twbs-bootstrap-6d03173/_layouts/home.html'], |
392
|
|
|
['twbs-bootstrap-6d03173/about.html'], |
393
|
|
|
['twbs-bootstrap-6d03173/components.html'], |
394
|
|
|
['twbs-bootstrap-6d03173/composer.json'], |
395
|
|
|
['twbs-bootstrap-6d03173/css.html'], |
396
|
|
|
['twbs-bootstrap-6d03173/customize.html'], |
397
|
|
|
['twbs-bootstrap-6d03173/docs-assets/css/docs.css'], |
398
|
|
|
['twbs-bootstrap-6d03173/docs-assets/css/pygments-manni.css'], |
399
|
|
|
['twbs-bootstrap-6d03173/docs-assets/ico/apple-touch-icon-144-precomposed.png'], |
400
|
|
|
['twbs-bootstrap-6d03173/docs-assets/ico/favicon.png'], |
401
|
|
|
['twbs-bootstrap-6d03173/docs-assets/js/application.js'], |
402
|
|
|
['twbs-bootstrap-6d03173/docs-assets/js/customizer.js'], |
403
|
|
|
['twbs-bootstrap-6d03173/docs-assets/js/filesaver.js'], |
404
|
|
|
['twbs-bootstrap-6d03173/docs-assets/js/holder.js'], |
405
|
|
|
['twbs-bootstrap-6d03173/docs-assets/js/ie8-responsive-file-warning.js'], |
406
|
|
|
['twbs-bootstrap-6d03173/docs-assets/js/jszip.js'], |
407
|
|
|
['twbs-bootstrap-6d03173/docs-assets/js/less.js'], |
408
|
|
|
['twbs-bootstrap-6d03173/docs-assets/js/raw-files.js'], |
409
|
|
|
['twbs-bootstrap-6d03173/docs-assets/js/uglify.js'], |
410
|
|
|
['twbs-bootstrap-6d03173/examples/carousel/carousel.css'], |
411
|
|
|
['twbs-bootstrap-6d03173/examples/carousel/index.html'], |
412
|
|
|
['twbs-bootstrap-6d03173/examples/grid/grid.css'], |
413
|
|
|
['twbs-bootstrap-6d03173/examples/grid/index.html'], |
414
|
|
|
['twbs-bootstrap-6d03173/examples/jumbotron-narrow/index.html'], |
415
|
|
|
['twbs-bootstrap-6d03173/examples/jumbotron-narrow/jumbotron-narrow.css'], |
416
|
|
|
['twbs-bootstrap-6d03173/examples/jumbotron/index.html'], |
417
|
|
|
['twbs-bootstrap-6d03173/examples/jumbotron/jumbotron.css'], |
418
|
|
|
['twbs-bootstrap-6d03173/examples/justified-nav/index.html'], |
419
|
|
|
['twbs-bootstrap-6d03173/examples/justified-nav/justified-nav.css'], |
420
|
|
|
['twbs-bootstrap-6d03173/examples/navbar-fixed-top/index.html'], |
421
|
|
|
['twbs-bootstrap-6d03173/examples/navbar-fixed-top/navbar-fixed-top.css'], |
422
|
|
|
['twbs-bootstrap-6d03173/examples/navbar-static-top/index.html'], |
423
|
|
|
['twbs-bootstrap-6d03173/examples/navbar-static-top/navbar-static-top.css'], |
424
|
|
|
['twbs-bootstrap-6d03173/examples/navbar/index.html'], |
425
|
|
|
['twbs-bootstrap-6d03173/examples/navbar/navbar.css'], |
426
|
|
|
['twbs-bootstrap-6d03173/examples/non-responsive/index.html'], |
427
|
|
|
['twbs-bootstrap-6d03173/examples/non-responsive/non-responsive.css'], |
428
|
|
|
['twbs-bootstrap-6d03173/examples/offcanvas/index.html'], |
429
|
|
|
['twbs-bootstrap-6d03173/examples/offcanvas/offcanvas.css'], |
430
|
|
|
['twbs-bootstrap-6d03173/examples/offcanvas/offcanvas.js'], |
431
|
|
|
['twbs-bootstrap-6d03173/examples/screenshots/carousel.jpg'], |
432
|
|
|
['twbs-bootstrap-6d03173/examples/screenshots/grid.jpg'], |
433
|
|
|
['twbs-bootstrap-6d03173/examples/screenshots/jumbotron-narrow.jpg'], |
434
|
|
|
['twbs-bootstrap-6d03173/examples/screenshots/jumbotron.jpg'], |
435
|
|
|
['twbs-bootstrap-6d03173/examples/screenshots/justified-nav.jpg'], |
436
|
|
|
['twbs-bootstrap-6d03173/examples/screenshots/navbar-fixed.jpg'], |
437
|
|
|
['twbs-bootstrap-6d03173/examples/screenshots/navbar-static.jpg'], |
438
|
|
|
['twbs-bootstrap-6d03173/examples/screenshots/navbar.jpg'], |
439
|
|
|
['twbs-bootstrap-6d03173/examples/screenshots/non-responsive.jpg'], |
440
|
|
|
['twbs-bootstrap-6d03173/examples/screenshots/offcanvas.jpg'], |
441
|
|
|
['twbs-bootstrap-6d03173/examples/screenshots/sign-in.jpg'], |
442
|
|
|
['twbs-bootstrap-6d03173/examples/screenshots/starter-template.jpg'], |
443
|
|
|
['twbs-bootstrap-6d03173/examples/screenshots/sticky-footer-navbar.jpg'], |
444
|
|
|
['twbs-bootstrap-6d03173/examples/screenshots/sticky-footer.jpg'], |
445
|
|
|
['twbs-bootstrap-6d03173/examples/screenshots/theme.jpg'], |
446
|
|
|
['twbs-bootstrap-6d03173/examples/signin/index.html'], |
447
|
|
|
['twbs-bootstrap-6d03173/examples/signin/signin.css'], |
448
|
|
|
['twbs-bootstrap-6d03173/examples/starter-template/index.html'], |
449
|
|
|
['twbs-bootstrap-6d03173/examples/starter-template/starter-template.css'], |
450
|
|
|
['twbs-bootstrap-6d03173/examples/sticky-footer-navbar/index.html'], |
451
|
|
|
['twbs-bootstrap-6d03173/examples/sticky-footer-navbar/sticky-footer-navbar.css'], |
452
|
|
|
['twbs-bootstrap-6d03173/examples/sticky-footer/index.html'], |
453
|
|
|
['twbs-bootstrap-6d03173/examples/sticky-footer/sticky-footer.css'], |
454
|
|
|
['twbs-bootstrap-6d03173/examples/theme/index.html'], |
455
|
|
|
['twbs-bootstrap-6d03173/examples/theme/theme.css'], |
456
|
|
|
['twbs-bootstrap-6d03173/fonts/glyphicons-halflings-regular.eot'], |
457
|
|
|
['twbs-bootstrap-6d03173/fonts/glyphicons-halflings-regular.svg'], |
458
|
|
|
['twbs-bootstrap-6d03173/fonts/glyphicons-halflings-regular.ttf'], |
459
|
|
|
['twbs-bootstrap-6d03173/fonts/glyphicons-halflings-regular.woff'], |
460
|
|
|
['twbs-bootstrap-6d03173/getting-started.html'], |
461
|
|
|
['twbs-bootstrap-6d03173/index.html'], |
462
|
|
|
['twbs-bootstrap-6d03173/javascript.html'], |
463
|
|
|
['twbs-bootstrap-6d03173/js/.jshintrc'], |
464
|
|
|
['twbs-bootstrap-6d03173/js/tests/index.html'], |
465
|
|
|
['twbs-bootstrap-6d03173/js/tests/unit/affix.js'], |
466
|
|
|
['twbs-bootstrap-6d03173/js/tests/unit/alert.js'], |
467
|
|
|
['twbs-bootstrap-6d03173/js/tests/unit/button.js'], |
468
|
|
|
['twbs-bootstrap-6d03173/js/tests/unit/carousel.js'], |
469
|
|
|
['twbs-bootstrap-6d03173/js/tests/unit/collapse.js'], |
470
|
|
|
['twbs-bootstrap-6d03173/js/tests/unit/dropdown.js'], |
471
|
|
|
['twbs-bootstrap-6d03173/js/tests/unit/modal.js'], |
472
|
|
|
['twbs-bootstrap-6d03173/js/tests/unit/phantom.js'], |
473
|
|
|
['twbs-bootstrap-6d03173/js/tests/unit/popover.js'], |
474
|
|
|
['twbs-bootstrap-6d03173/js/tests/unit/scrollspy.js'], |
475
|
|
|
['twbs-bootstrap-6d03173/js/tests/unit/tab.js'], |
476
|
|
|
['twbs-bootstrap-6d03173/js/tests/unit/tooltip.js'], |
477
|
|
|
['twbs-bootstrap-6d03173/js/tests/unit/transition.js'], |
478
|
|
|
['twbs-bootstrap-6d03173/js/tests/vendor/jquery.js'], |
479
|
|
|
['twbs-bootstrap-6d03173/js/tests/vendor/qunit.css'], |
480
|
|
|
['twbs-bootstrap-6d03173/js/tests/vendor/qunit.js'], |
481
|
|
|
['twbs-bootstrap-6d03173/package.json'], |
482
|
|
|
]; |
483
|
|
|
} |
484
|
|
|
|
485
|
|
|
public function providerNotIgnored() |
486
|
|
|
{ |
487
|
|
|
return [ |
488
|
|
|
['twbs-bootstrap-6d03173/DOCS-LICENSE'], |
489
|
|
|
['twbs-bootstrap-6d03173/LICENSE'], |
490
|
|
|
['twbs-bootstrap-6d03173/LICENSE-MIT'], |
491
|
|
|
['twbs-bootstrap-6d03173/README.md'], |
492
|
|
|
['twbs-bootstrap-6d03173/bower.json'], |
493
|
|
|
['twbs-bootstrap-6d03173/dist/css/bootstrap-theme.css'], |
494
|
|
|
['twbs-bootstrap-6d03173/dist/css/bootstrap-theme.min.css'], |
495
|
|
|
['twbs-bootstrap-6d03173/dist/css/bootstrap.css'], |
496
|
|
|
['twbs-bootstrap-6d03173/dist/css/bootstrap.min.css'], |
497
|
|
|
['twbs-bootstrap-6d03173/dist/fonts/glyphicons-halflings-regular.eot'], |
498
|
|
|
['twbs-bootstrap-6d03173/dist/fonts/glyphicons-halflings-regular.svg'], |
499
|
|
|
['twbs-bootstrap-6d03173/dist/fonts/glyphicons-halflings-regular.ttf'], |
500
|
|
|
['twbs-bootstrap-6d03173/dist/fonts/glyphicons-halflings-regular.woff'], |
501
|
|
|
['twbs-bootstrap-6d03173/dist/js/bootstrap.js'], |
502
|
|
|
['twbs-bootstrap-6d03173/dist/js/bootstrap.min.js'], |
503
|
|
|
['twbs-bootstrap-6d03173/js/affix.js'], |
504
|
|
|
['twbs-bootstrap-6d03173/js/alert.js'], |
505
|
|
|
['twbs-bootstrap-6d03173/js/button.js'], |
506
|
|
|
['twbs-bootstrap-6d03173/js/carousel.js'], |
507
|
|
|
['twbs-bootstrap-6d03173/js/collapse.js'], |
508
|
|
|
['twbs-bootstrap-6d03173/js/dropdown.js'], |
509
|
|
|
['twbs-bootstrap-6d03173/js/modal.js'], |
510
|
|
|
['twbs-bootstrap-6d03173/js/popover.js'], |
511
|
|
|
['twbs-bootstrap-6d03173/js/scrollspy.js'], |
512
|
|
|
['twbs-bootstrap-6d03173/js/tab.js'], |
513
|
|
|
['twbs-bootstrap-6d03173/js/tooltip.js'], |
514
|
|
|
['twbs-bootstrap-6d03173/js/transition.js'], |
515
|
|
|
['twbs-bootstrap-6d03173/less/alerts.less'], |
516
|
|
|
['twbs-bootstrap-6d03173/less/badges.less'], |
517
|
|
|
['twbs-bootstrap-6d03173/less/bootstrap.less'], |
518
|
|
|
['twbs-bootstrap-6d03173/less/breadcrumbs.less'], |
519
|
|
|
['twbs-bootstrap-6d03173/less/button-groups.less'], |
520
|
|
|
['twbs-bootstrap-6d03173/less/buttons.less'], |
521
|
|
|
['twbs-bootstrap-6d03173/less/carousel.less'], |
522
|
|
|
['twbs-bootstrap-6d03173/less/close.less'], |
523
|
|
|
['twbs-bootstrap-6d03173/less/code.less'], |
524
|
|
|
['twbs-bootstrap-6d03173/less/component-animations.less'], |
525
|
|
|
['twbs-bootstrap-6d03173/less/dropdowns.less'], |
526
|
|
|
['twbs-bootstrap-6d03173/less/forms.less'], |
527
|
|
|
['twbs-bootstrap-6d03173/less/glyphicons.less'], |
528
|
|
|
['twbs-bootstrap-6d03173/less/grid.less'], |
529
|
|
|
['twbs-bootstrap-6d03173/less/input-groups.less'], |
530
|
|
|
['twbs-bootstrap-6d03173/less/jumbotron.less'], |
531
|
|
|
['twbs-bootstrap-6d03173/less/labels.less'], |
532
|
|
|
['twbs-bootstrap-6d03173/less/list-group.less'], |
533
|
|
|
['twbs-bootstrap-6d03173/less/media.less'], |
534
|
|
|
['twbs-bootstrap-6d03173/less/mixins.less'], |
535
|
|
|
['twbs-bootstrap-6d03173/less/modals.less'], |
536
|
|
|
['twbs-bootstrap-6d03173/less/navbar.less'], |
537
|
|
|
['twbs-bootstrap-6d03173/less/navs.less'], |
538
|
|
|
['twbs-bootstrap-6d03173/less/normalize.less'], |
539
|
|
|
['twbs-bootstrap-6d03173/less/pager.less'], |
540
|
|
|
['twbs-bootstrap-6d03173/less/pagination.less'], |
541
|
|
|
['twbs-bootstrap-6d03173/less/panels.less'], |
542
|
|
|
['twbs-bootstrap-6d03173/less/popovers.less'], |
543
|
|
|
['twbs-bootstrap-6d03173/less/print.less'], |
544
|
|
|
['twbs-bootstrap-6d03173/less/progress-bars.less'], |
545
|
|
|
['twbs-bootstrap-6d03173/less/responsive-utilities.less'], |
546
|
|
|
['twbs-bootstrap-6d03173/less/scaffolding.less'], |
547
|
|
|
['twbs-bootstrap-6d03173/less/tables.less'], |
548
|
|
|
['twbs-bootstrap-6d03173/less/theme.less'], |
549
|
|
|
['twbs-bootstrap-6d03173/less/thumbnails.less'], |
550
|
|
|
['twbs-bootstrap-6d03173/less/tooltip.less'], |
551
|
|
|
['twbs-bootstrap-6d03173/less/type.less'], |
552
|
|
|
['twbs-bootstrap-6d03173/less/utilities.less'], |
553
|
|
|
['twbs-bootstrap-6d03173/less/variables.less'], |
554
|
|
|
['twbs-bootstrap-6d03173/less/wells.less'], |
555
|
|
|
]; |
556
|
|
|
} |
557
|
|
|
|
558
|
|
|
public function providerIgnoreExceptions() |
559
|
|
|
{ |
560
|
|
|
return [ |
561
|
|
|
['zeroclipboard-zeroclipboard-1ec7da6/test/shared/private.tests.js.html', true], |
562
|
|
|
['zeroclipboard-zeroclipboard-1ec7da6/src/meta/composer.json.tmpl', true], |
563
|
|
|
['zeroclipboard-zeroclipboard-1ec7da6/dist/ZeroClipboard.swf', false], |
564
|
|
|
['zeroclipboard-zeroclipboard-1ec7da6/bower.json', false], |
565
|
|
|
]; |
566
|
|
|
} |
567
|
|
|
|
568
|
|
|
/** |
569
|
|
|
* @dataProvider providerIgnoreExceptions |
570
|
|
|
*/ |
571
|
|
|
public function testIgnoreExceptions($file, $shouldIgnore) |
572
|
|
|
{ |
573
|
|
|
$ignore = [ |
574
|
|
|
'*', |
575
|
|
|
'!/bower.json', |
576
|
|
|
'!/dist/**', |
577
|
|
|
]; |
578
|
|
|
$ignored = $this->installer->isIgnored($file, $ignore, [], 'zeroclipboard-zeroclipboard-1ec7da6/'); |
579
|
|
|
$this->assertEquals($ignored, $shouldIgnore); |
580
|
|
|
} |
581
|
|
|
|
582
|
|
|
public function providerIgnoreAllExceptNegations() |
583
|
|
|
{ |
584
|
|
|
return [ |
585
|
|
|
['pippo/src/foo.js', true], |
586
|
|
|
['pippo/dist/.htaccess', false], |
587
|
|
|
['pippo/bower.json', true], |
588
|
|
|
]; |
589
|
|
|
} |
590
|
|
|
|
591
|
|
|
/** |
592
|
|
|
* See issue https://github.com/Bee-Lab/bowerphp/issues/126 |
593
|
|
|
* |
594
|
|
|
* @dataProvider providerIgnoreAllExceptNegations |
595
|
|
|
*/ |
596
|
|
|
public function testIgnoreAllExceptNegations($file, $shouldIgnore) |
597
|
|
|
{ |
598
|
|
|
$ignore = [ |
599
|
|
|
'**/*', |
600
|
|
|
'!/dist/**', |
601
|
|
|
]; |
602
|
|
|
$ignored = $this->installer->isIgnored($file, $ignore, [], 'pippo/'); |
603
|
|
|
$this->assertEquals($ignored, $shouldIgnore); |
604
|
|
|
} |
605
|
|
|
} |
606
|
|
|
|
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.