1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* |
5
|
|
|
* The MIT License (MIT) |
6
|
|
|
* |
7
|
|
|
* Copyright (c) 2016 Daniel Popiniuc |
8
|
|
|
* |
9
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
10
|
|
|
* of this software and associated documentation files (the "Software"), to deal |
11
|
|
|
* in the Software without restriction, including without limitation the rights |
12
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
13
|
|
|
* copies of the Software, and to permit persons to whom the Software is |
14
|
|
|
* furnished to do so, subject to the following conditions: |
15
|
|
|
* |
16
|
|
|
* The above copyright notice and this permission notice shall be included in all |
17
|
|
|
* copies or substantial portions of the Software. |
18
|
|
|
* |
19
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
20
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
21
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
22
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
23
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
24
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
25
|
|
|
* SOFTWARE. |
26
|
|
|
* |
27
|
|
|
*/ |
28
|
|
|
class ComposerPackagesListingTest extends PHPUnit_Framework_TestCase |
|
|
|
|
29
|
|
|
{ |
30
|
|
|
|
31
|
|
|
use \danielgp\composer_packages_listing\ComposerPackagesListing; |
32
|
|
|
|
33
|
|
|
public function testGetPackageDetailsFromGivenComposerLockFile() |
34
|
|
|
{ |
35
|
|
|
$pathParts = explode(DIRECTORY_SEPARATOR, __DIR__); |
36
|
|
|
$file = implode(DIRECTORY_SEPARATOR, array_diff($pathParts, ['tests', 'php-unit'])) |
37
|
|
|
. DIRECTORY_SEPARATOR . 'composer.lock'; |
38
|
|
|
$actual = $this->getPackageDetailsFromGivenComposerLockFile($file); |
39
|
|
|
$this->assertArrayHasKey('Aging', $actual['gettext/gettext']); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function testGetPackageDetailsFromGivenComposerLockFileError() |
43
|
|
|
{ |
44
|
|
|
$actual = $this->getPackageDetailsFromGivenComposerLockFile('composer.not'); |
45
|
|
|
$this->assertArrayHasKey('error', $actual); |
46
|
|
|
} |
47
|
|
|
} |
48
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.