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