2022-02-23 15:58:18 +00:00
< ? php declare ( strict_types = 1 );
2012-07-18 15:20:01 +00:00
/*
* This file is part of Composer .
*
* ( c ) Nils Adermann < naderman @ naderman . de >
* Jordi Boggiano < j . boggiano @ seld . be >
*
* For the full copyright and license information , please view the LICENSE
* file that was distributed with this source code .
*/
namespace Composer\Test\Package\Loader ;
use Composer\Package\Loader\ValidatingArrayLoader ;
2012-11-02 14:14:09 +00:00
use Composer\Package\Loader\InvalidPackageException ;
2020-02-07 03:18:45 +00:00
use Composer\Test\TestCase ;
2012-07-18 15:20:01 +00:00
2017-11-04 14:52:13 +00:00
class ValidatingArrayLoaderTest extends TestCase
2012-07-18 15:20:01 +00:00
{
/**
* @ dataProvider successProvider
2021-11-01 20:44:12 +00:00
*
* @ param array < string , mixed > $config
2012-07-18 15:20:01 +00:00
*/
2022-02-22 15:47:09 +00:00
public function testLoadSuccess ( array $config ) : void
2012-07-18 15:20:01 +00:00
{
2018-04-12 08:24:56 +00:00
$internalLoader = $this -> getMockBuilder ( 'Composer\Package\Loader\LoaderInterface' ) -> getMock ();
2012-07-18 15:20:01 +00:00
$internalLoader
-> expects ( $this -> once ())
-> method ( 'load' )
-> with ( $config );
2014-04-09 13:23:43 +00:00
$loader = new ValidatingArrayLoader ( $internalLoader , true , null , ValidatingArrayLoader :: CHECK_ALL );
2012-07-18 15:20:01 +00:00
$loader -> load ( $config );
}
2022-11-24 13:39:08 +00:00
public static function successProvider () : array
2012-07-18 15:20:01 +00:00
{
2022-08-17 12:20:07 +00:00
return [
[ // minimal
[
2012-07-18 15:20:01 +00:00
'name' => 'foo/bar' ,
2022-08-17 12:20:07 +00:00
],
],
[ // complete
[
2012-07-18 15:20:01 +00:00
'name' => 'foo/bar' ,
'description' => 'Foo bar' ,
'version' => '1.0.0' ,
'type' => 'library' ,
2022-08-17 12:20:07 +00:00
'keywords' => [ 'a' , 'b_c' , 'D E' , 'éîüø' , '微信' ],
2012-07-18 15:20:01 +00:00
'homepage' => 'https://foo.com' ,
'time' => '2010-10-10T10:10:10+00:00' ,
2024-11-26 13:49:36 +00:00
'license' => [ 'MIT' , 'WTFPL' ],
2022-08-17 12:20:07 +00:00
'authors' => [
[
2012-07-18 15:20:01 +00:00
'name' => 'Alice' ,
'email' => 'alice@example.org' ,
'role' => 'Lead' ,
'homepage' => 'http://example.org' ,
2022-08-17 12:20:07 +00:00
],
[
2012-07-18 15:20:01 +00:00
'name' => 'Bob' ,
2012-11-05 14:39:43 +00:00
'homepage' => '' ,
2022-08-17 12:20:07 +00:00
],
],
'support' => [
2012-07-18 15:20:01 +00:00
'email' => 'mail@example.org' ,
'issues' => 'http://example.org/' ,
'forum' => 'http://example.org/' ,
'wiki' => 'http://example.org/' ,
'source' => 'http://example.org/' ,
'irc' => 'irc://example.org/example' ,
2016-05-16 21:23:10 +00:00
'rss' => 'http://example.org/rss' ,
2018-10-14 11:15:25 +00:00
'chat' => 'http://example.org/chat' ,
2023-03-10 21:28:10 +00:00
'security' => 'https://example.org/security' ,
2022-08-17 12:20:07 +00:00
],
'funding' => [
[
2019-11-28 21:34:29 +00:00
'type' => 'example' ,
2020-11-22 13:48:56 +00:00
'url' => 'https://example.org/fund' ,
2022-08-17 12:20:07 +00:00
],
[
2020-11-22 13:48:56 +00:00
'url' => 'https://example.org/fund' ,
2022-08-17 12:20:07 +00:00
],
],
'require' => [
2012-07-18 15:20:01 +00:00
'a/b' => '1.*' ,
2013-10-12 00:29:16 +00:00
'b/c' => '~2' ,
2021-11-25 11:33:59 +00:00
'example/pkg' => '>2.0-dev,<2.4-dev' ,
2020-04-28 14:04:00 +00:00
'composer-runtime-api' => '*' ,
2022-08-17 12:20:07 +00:00
],
'require-dev' => [
2012-07-18 15:20:01 +00:00
'a/b' => '1.*' ,
2013-10-12 00:29:16 +00:00
'b/c' => '*' ,
2021-11-25 11:33:59 +00:00
'example/pkg' => '>2.0-dev,<2.4-dev' ,
2022-08-17 12:20:07 +00:00
],
'conflict' => [
2021-11-25 11:33:59 +00:00
'a/bx' => '1.*' ,
'b/cx' => '>2.7' ,
'example/pkgx' => '>2.0-dev,<2.4-dev' ,
2022-08-17 12:20:07 +00:00
],
'replace' => [
2012-07-18 15:20:01 +00:00
'a/b' => '1.*' ,
2021-11-25 11:33:59 +00:00
'example/pkg' => '>2.0-dev,<2.4-dev' ,
2022-08-17 12:20:07 +00:00
],
'provide' => [
2012-07-18 15:20:01 +00:00
'a/b' => '1.*' ,
2021-11-25 11:33:59 +00:00
'example/pkg' => '>2.0-dev,<2.4-dev' ,
2022-08-17 12:20:07 +00:00
],
'suggest' => [
2012-07-18 15:20:01 +00:00
'foo/bar' => 'Foo bar is very useful' ,
2022-08-17 12:20:07 +00:00
],
'autoload' => [
'psr-0' => [
2012-07-18 15:20:01 +00:00
'Foo\\Bar' => 'src/' ,
'' => 'fallback/libs/' ,
2022-08-17 12:20:07 +00:00
],
'classmap' => [
2012-07-18 15:20:01 +00:00
'dir/' ,
'dir2/file.php' ,
2022-08-17 12:20:07 +00:00
],
'files' => [
2012-07-18 15:20:01 +00:00
'functions.php' ,
2022-08-17 12:20:07 +00:00
],
],
'include-path' => [
2012-07-18 15:20:01 +00:00
'lib/' ,
2022-08-17 12:20:07 +00:00
],
2012-07-18 15:20:01 +00:00
'target-dir' => 'Foo/Bar' ,
'minimum-stability' => 'dev' ,
2022-08-17 12:20:07 +00:00
'repositories' => [
[
2012-07-18 15:20:01 +00:00
'type' => 'composer' ,
2018-07-24 07:30:06 +00:00
'url' => 'https://repo.packagist.org/' ,
2022-08-17 12:20:07 +00:00
],
],
'config' => [
2012-07-18 15:20:01 +00:00
'bin-dir' => 'bin' ,
'vendor-dir' => 'vendor' ,
'process-timeout' => 10000 ,
2022-08-17 12:20:07 +00:00
],
'archive' => [
'exclude' => [ '/foo/bar' , 'baz' , '!/foo/bar/baz' ],
],
'scripts' => [
2012-07-18 15:20:01 +00:00
'post-update-cmd' => 'Foo\\Bar\\Baz::doSomething' ,
2022-08-17 12:20:07 +00:00
'post-install-cmd' => [
2012-07-18 15:20:01 +00:00
'Foo\\Bar\\Baz::doSomething' ,
2022-08-17 12:20:07 +00:00
],
],
'extra' => [
'random' => [ 'stuff' => [ 'deeply' => 'nested' ]],
'branch-alias' => [
2012-11-05 13:14:55 +00:00
'dev-master' => '2.0-dev' ,
'dev-old' => '1.0.x-dev' ,
2015-09-28 09:51:14 +00:00
'3.x-dev' => '3.1.x-dev' ,
2022-08-17 12:20:07 +00:00
],
],
'bin' => [
2012-07-18 15:20:01 +00:00
'bin/foo' ,
'bin/bar' ,
2022-08-17 12:20:07 +00:00
],
'transport-options' => [ 'ssl' => [ 'local_cert' => '/opt/certs/test.pem' ]],
],
],
[ // test bin as string
[
2018-01-02 08:55:41 +00:00
'name' => 'foo/bar' ,
'bin' => 'bin1' ,
2022-08-17 12:20:07 +00:00
],
],
[ // package name with dashes
[
2020-04-10 14:27:37 +00:00
'name' => 'foo/bar-baz' ,
2022-08-17 12:20:07 +00:00
],
],
[ // package name with dashes
[
2020-04-10 14:27:37 +00:00
'name' => 'foo/bar--baz' ,
2022-08-17 12:20:07 +00:00
],
],
[ // package name with dashes
[
2020-04-10 14:27:37 +00:00
'name' => 'foo/b-ar--ba-z' ,
2022-08-17 12:20:07 +00:00
],
],
[ // package name with dashes
[
2020-04-10 14:27:37 +00:00
'name' => 'npm-asset/angular--core' ,
2022-08-17 12:20:07 +00:00
],
],
[ // refs as int or string
[
2021-04-30 07:40:58 +00:00
'name' => 'foo/bar' ,
2022-08-17 12:20:07 +00:00
'source' => [ 'url' => 'https://example.org' , 'reference' => 1234 , 'type' => 'baz' ],
'dist' => [ 'url' => 'https://example.org' , 'reference' => 'foobar' , 'type' => 'baz' ],
],
],
];
2012-07-18 15:20:01 +00:00
}
/**
2012-11-05 11:08:02 +00:00
* @ dataProvider errorProvider
2021-11-01 20:44:12 +00:00
*
* @ param array < string , mixed > $config
* @ param string [] $expectedErrors
2012-07-18 15:20:01 +00:00
*/
2022-02-22 15:47:09 +00:00
public function testLoadFailureThrowsException ( array $config , array $expectedErrors ) : void
2012-07-18 15:20:01 +00:00
{
2018-04-12 08:24:56 +00:00
$internalLoader = $this -> getMockBuilder ( 'Composer\Package\Loader\LoaderInterface' ) -> getMock ();
2014-04-09 13:23:43 +00:00
$loader = new ValidatingArrayLoader ( $internalLoader , true , null , ValidatingArrayLoader :: CHECK_ALL );
2012-07-18 15:20:01 +00:00
try {
$loader -> load ( $config );
$this -> fail ( 'Expected exception to be thrown' );
2012-11-02 14:14:09 +00:00
} catch ( InvalidPackageException $e ) {
$errors = $e -> getErrors ();
2012-07-18 15:20:01 +00:00
sort ( $expectedErrors );
sort ( $errors );
2024-05-29 21:12:06 +00:00
self :: assertEquals ( $expectedErrors , $errors );
2012-07-18 15:20:01 +00:00
}
}
/**
2012-11-05 11:08:02 +00:00
* @ dataProvider warningProvider
2021-11-01 20:44:12 +00:00
*
* @ param array < string , mixed > $config
* @ param string [] $expectedWarnings
2012-07-18 15:20:01 +00:00
*/
2022-02-22 15:47:09 +00:00
public function testLoadWarnings ( array $config , array $expectedWarnings ) : void
2012-11-05 11:08:02 +00:00
{
2018-04-12 08:24:56 +00:00
$internalLoader = $this -> getMockBuilder ( 'Composer\Package\Loader\LoaderInterface' ) -> getMock ();
2014-04-09 13:23:43 +00:00
$loader = new ValidatingArrayLoader ( $internalLoader , true , null , ValidatingArrayLoader :: CHECK_ALL );
2012-11-05 11:08:02 +00:00
$loader -> load ( $config );
$warnings = $loader -> getWarnings ();
sort ( $expectedWarnings );
sort ( $warnings );
2024-05-29 21:12:06 +00:00
self :: assertEquals ( $expectedWarnings , $warnings );
2012-11-05 11:08:02 +00:00
}
/**
* @ dataProvider warningProvider
2021-11-01 20:44:12 +00:00
*
* @ param array < string , mixed > $config
* @ param string [] $expectedWarnings
2024-11-26 13:52:33 +00:00
* @ param array < string , mixed >| null $expectedArray
2012-11-05 11:08:02 +00:00
*/
2024-11-26 13:49:36 +00:00
public function testLoadSkipsWarningDataWhenIgnoringErrors ( array $config , array $expectedWarnings , bool $mustCheck = true , ? array $expectedArray = null ) : void
2012-07-18 15:20:01 +00:00
{
2014-04-09 13:23:43 +00:00
if ( ! $mustCheck ) {
2024-05-29 21:12:06 +00:00
self :: assertTrue ( true ); // @phpstan-ignore staticMethod.alreadyNarrowedType
2014-06-10 14:02:44 +00:00
2014-04-09 13:23:43 +00:00
return ;
}
2018-04-12 08:24:56 +00:00
$internalLoader = $this -> getMockBuilder ( 'Composer\Package\Loader\LoaderInterface' ) -> getMock ();
2012-07-18 15:20:01 +00:00
$internalLoader
-> expects ( $this -> once ())
-> method ( 'load' )
2024-11-26 13:49:36 +00:00
-> with ( $expectedArray ? ? [ 'name' => 'a/b' ]);
2012-07-18 15:20:01 +00:00
2014-04-09 13:23:43 +00:00
$loader = new ValidatingArrayLoader ( $internalLoader , true , null , ValidatingArrayLoader :: CHECK_ALL );
2012-07-18 15:20:01 +00:00
$config [ 'name' ] = 'a/b' ;
$loader -> load ( $config );
}
2022-11-24 13:39:08 +00:00
public static function errorProvider () : array
2012-07-18 15:20:01 +00:00
{
2022-08-17 12:20:07 +00:00
$invalidNames = [
2020-04-10 14:27:37 +00:00
'foo' ,
'foo/-bar-' ,
'foo/-bar' ,
2022-08-17 12:20:07 +00:00
];
$invalidNaming = [];
2020-11-22 13:48:56 +00:00
foreach ( $invalidNames as $invalidName ) {
2022-08-17 12:20:07 +00:00
$invalidNaming [] = [
[
2020-04-10 14:27:37 +00:00
'name' => $invalidName ,
2022-08-17 12:20:07 +00:00
],
[
2021-11-25 11:33:59 +00:00
" name : $invalidName is invalid, it should have a vendor name, a forward slash, and a package name. The vendor and package name can be words separated by -, . or _. The complete name should match \" ^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|- { 0,2})[a-z0-9]+)* $\ " . " ,
2022-08-17 12:20:07 +00:00
],
];
2021-11-25 11:33:59 +00:00
}
2022-08-17 12:20:07 +00:00
$invalidNames = [
2021-11-25 11:33:59 +00:00
'fo--oo/bar' ,
'fo-oo/bar__baz' ,
'fo-oo/bar_.baz' ,
'foo/bar---baz' ,
2022-08-17 12:20:07 +00:00
];
2021-11-25 11:33:59 +00:00
foreach ( $invalidNames as $invalidName ) {
2022-08-17 12:20:07 +00:00
$invalidNaming [] = [
[
2021-11-25 11:33:59 +00:00
'name' => $invalidName ,
2022-08-17 12:20:07 +00:00
],
[
2021-11-25 11:33:59 +00:00
" name : $invalidName is invalid, it should have a vendor name, a forward slash, and a package name. The vendor and package name can be words separated by -, . or _. The complete name should match \" ^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|- { 0,2})[a-z0-9]+)* $\ " . " ,
2022-08-17 12:20:07 +00:00
],
2021-11-25 11:33:59 +00:00
false ,
2022-08-17 12:20:07 +00:00
];
2020-04-10 14:27:37 +00:00
}
2022-08-17 12:20:07 +00:00
return array_merge ( $invalidNaming , [
[
[
2012-11-05 11:08:02 +00:00
'name' => 'foo/bar' ,
'homepage' => 43 ,
2022-08-17 12:20:07 +00:00
],
[
2012-11-05 11:08:02 +00:00
'homepage : should be a string, integer given' ,
2022-08-17 12:20:07 +00:00
],
],
[
[
2012-11-05 11:08:02 +00:00
'name' => 'foo/bar' ,
2022-08-17 12:20:07 +00:00
'support' => [
'source' => [],
],
],
[
2012-11-05 11:08:02 +00:00
'support.source : invalid value, must be a string' ,
2022-08-17 12:20:07 +00:00
],
],
[
[
2021-11-25 11:33:59 +00:00
'name' => 'foo/bar.json' ,
2022-08-17 12:20:07 +00:00
],
[
2021-11-25 11:33:59 +00:00
'name : foo/bar.json is invalid, package names can not end in .json, consider renaming it or perhaps using a -json suffix instead.' ,
2022-08-17 12:20:07 +00:00
],
],
[
[
2021-11-25 11:33:59 +00:00
'name' => 'com1/foo' ,
2022-08-17 12:20:07 +00:00
],
[
2021-11-25 11:33:59 +00:00
'name : com1/foo is reserved, package and vendor names can not match any of: nul, con, prn, aux, com1, com2, com3, com4, com5, com6, com7, com8, com9, lpt1, lpt2, lpt3, lpt4, lpt5, lpt6, lpt7, lpt8, lpt9.' ,
2022-08-17 12:20:07 +00:00
],
],
[
[
2021-11-25 11:33:59 +00:00
'name' => 'Foo/Bar' ,
2022-08-17 12:20:07 +00:00
],
[
2021-11-25 11:33:59 +00:00
'name : Foo/Bar is invalid, it should not contain uppercase characters. We suggest using foo/bar instead.' ,
2022-08-17 12:20:07 +00:00
],
],
[
[
2013-04-25 19:02:15 +00:00
'name' => 'foo/bar' ,
'autoload' => 'strings' ,
2022-08-17 12:20:07 +00:00
],
[
2015-09-28 09:51:14 +00:00
'autoload : should be an array, string given' ,
2022-08-17 12:20:07 +00:00
],
],
[
[
2013-04-25 19:02:15 +00:00
'name' => 'foo/bar' ,
2022-08-17 12:20:07 +00:00
'autoload' => [
'psr0' => [
2013-04-25 19:02:15 +00:00
'foo' => 'src' ,
2022-08-17 12:20:07 +00:00
],
],
],
[
2015-10-30 20:40:09 +00:00
'autoload : invalid value (psr0), must be one of psr-0, psr-4, classmap, files, exclude-from-classmap' ,
2022-08-17 12:20:07 +00:00
],
],
[
[
2013-08-19 07:40:08 +00:00
'name' => 'foo/bar' ,
2014-05-07 16:25:28 +00:00
'transport-options' => 'test' ,
2022-08-17 12:20:07 +00:00
],
[
2015-09-28 09:51:14 +00:00
'transport-options : should be an array, string given' ,
2022-08-17 12:20:07 +00:00
],
],
[
[
2021-04-28 19:53:09 +00:00
'name' => 'foo/bar' ,
2022-08-17 12:20:07 +00:00
'source' => [ 'url' => '--foo' , 'reference' => ' --bar' , 'type' => 'baz' ],
'dist' => [ 'url' => ' --foox' , 'reference' => '--barx' , 'type' => 'baz' ],
],
[
2021-04-28 19:53:09 +00:00
'dist.reference : must not start with a "-", "--barx" given' ,
'dist.url : must not start with a "-", " --foox" given' ,
'source.reference : must not start with a "-", " --bar" given' ,
'source.url : must not start with a "-", "--foo" given' ,
2022-08-17 12:20:07 +00:00
],
],
[
[
2021-11-10 10:07:44 +00:00
'name' => 'foo/bar' ,
2022-08-17 12:20:07 +00:00
'require' => [ 'foo/Bar' => '1.*' ],
],
[
2021-11-10 10:07:44 +00:00
'require.foo/Bar : a package cannot set a require on itself' ,
2022-08-17 12:20:07 +00:00
],
],
[
[
2022-03-26 13:40:20 +00:00
'name' => 'foo/bar' ,
2022-08-17 12:20:07 +00:00
'source' => [ 'url' => 1 ],
'dist' => [ 'url' => null ],
],
[
2022-03-26 13:40:20 +00:00
'source.type : must be present' ,
'source.url : should be a string, integer given' ,
'source.reference : must be present' ,
'dist.type : must be present' ,
'dist.url : must be present' ,
2022-08-17 12:20:07 +00:00
],
],
[
[
2022-06-24 08:30:33 +00:00
'name' => 'foo/bar' ,
2022-08-17 12:20:07 +00:00
'replace' => [ 'acme/bar' ],
],
[ 'replace.0 : invalid version constraint (Could not parse version constraint acme/bar: Invalid version string "acme/bar")' ],
],
2024-02-06 16:18:41 +00:00
[
[
'require' => [ 'acme/bar' => '^1.0' ]
],
[ 'name : must be present' ],
]
2022-08-17 12:20:07 +00:00
]);
2012-11-05 11:08:02 +00:00
}
2022-11-24 13:39:08 +00:00
public static function warningProvider () : array
2012-11-05 11:08:02 +00:00
{
2022-08-17 12:20:07 +00:00
return [
[
[
2012-07-18 15:20:01 +00:00
'name' => 'foo/bar' ,
'homepage' => 'foo:bar' ,
2022-08-17 12:20:07 +00:00
],
[
2015-09-28 09:51:14 +00:00
'homepage : invalid value (foo:bar), must be an http/https URL' ,
2022-08-17 12:20:07 +00:00
],
],
[
[
2012-07-18 15:20:01 +00:00
'name' => 'foo/bar' ,
2022-08-17 12:20:07 +00:00
'support' => [
2012-07-18 15:20:01 +00:00
'source' => 'foo:bar' ,
'forum' => 'foo:bar' ,
'issues' => 'foo:bar' ,
'wiki' => 'foo:bar' ,
2018-10-14 11:15:25 +00:00
'chat' => 'foo:bar' ,
2023-03-10 21:28:10 +00:00
'security' => 'foo:bar' ,
2022-08-17 12:20:07 +00:00
],
],
[
2012-11-05 19:04:29 +00:00
'support.source : invalid value (foo:bar), must be an http/https URL' ,
'support.forum : invalid value (foo:bar), must be an http/https URL' ,
'support.issues : invalid value (foo:bar), must be an http/https URL' ,
'support.wiki : invalid value (foo:bar), must be an http/https URL' ,
2018-10-14 11:15:25 +00:00
'support.chat : invalid value (foo:bar), must be an http/https URL' ,
2023-03-10 21:28:10 +00:00
'support.security : invalid value (foo:bar), must be an http/https URL' ,
2022-08-17 12:20:07 +00:00
],
],
[
[
2013-10-12 00:29:16 +00:00
'name' => 'foo/bar' ,
2022-08-17 12:20:07 +00:00
'require' => [
2013-10-12 00:29:16 +00:00
'foo/baz' => '*' ,
'bar/baz' => '>=1.0' ,
'bar/hacked' => '@stable' ,
2016-04-15 15:37:47 +00:00
'bar/woo' => '1.0.0' ,
2022-08-17 12:20:07 +00:00
],
],
[
2014-04-09 13:23:43 +00:00
'require.foo/baz : unbound version constraints (*) should be avoided' ,
'require.bar/baz : unbound version constraints (>=1.0) should be avoided' ,
'require.bar/hacked : unbound version constraints (@stable) should be avoided' ,
2016-04-15 15:37:47 +00:00
'require.bar/woo : exact version constraints (1.0.0) should be avoided if the package follows semantic versioning' ,
2022-08-17 12:20:07 +00:00
],
2015-09-28 09:51:14 +00:00
false ,
2022-08-17 12:20:07 +00:00
],
2024-02-06 11:57:52 +00:00
[
[
'name' => 'foo/bar' ,
'require' => [
'foo/baz' => '>1, <0.5' ,
'bar/baz' => 'dev-main, >0.5' ,
],
],
[
'require.foo/baz : this version constraint cannot possibly match anything (>1, <0.5)' ,
'require.bar/baz : this version constraint cannot possibly match anything (dev-main, >0.5)' ,
],
false ,
],
2022-08-17 12:20:07 +00:00
[
[
2016-05-15 20:15:48 +00:00
'name' => 'foo/bar' ,
2022-08-17 12:20:07 +00:00
'require' => [
2016-05-15 20:15:48 +00:00
'bar/unstable' => '0.3.0' ,
2022-08-17 12:20:07 +00:00
],
],
[
2016-05-15 20:15:48 +00:00
// using an exact version constraint for an unstable version should not trigger a warning
2022-08-17 12:20:07 +00:00
],
2016-05-15 20:15:48 +00:00
false ,
2022-08-17 12:20:07 +00:00
],
[
[
2014-12-01 05:09:35 +00:00
'name' => 'foo/bar' ,
2022-08-17 12:20:07 +00:00
'extra' => [
'branch-alias' => [
2015-09-28 09:51:14 +00:00
'5.x-dev' => '3.1.x-dev' ,
2022-08-17 12:20:07 +00:00
],
],
],
[
2015-09-28 09:51:14 +00:00
'extra.branch-alias.5.x-dev : the target branch (3.1.x-dev) is not a valid numeric alias for this version' ,
2022-08-17 12:20:07 +00:00
],
2015-09-28 09:51:14 +00:00
false ,
2022-08-17 12:20:07 +00:00
],
[
[
2015-01-20 10:26:10 +00:00
'name' => 'foo/bar' ,
2022-08-17 12:20:07 +00:00
'extra' => [
'branch-alias' => [
2015-09-28 09:51:14 +00:00
'5.x-dev' => '3.1-dev' ,
2022-08-17 12:20:07 +00:00
],
],
],
[
2015-09-28 09:51:14 +00:00
'extra.branch-alias.5.x-dev : the target branch (3.1-dev) is not a valid numeric alias for this version' ,
2022-08-17 12:20:07 +00:00
],
2015-09-28 09:51:14 +00:00
false ,
2022-08-17 12:20:07 +00:00
],
[
[
2022-04-29 12:58:38 +00:00
'name' => 'foo/bar' ,
2022-08-17 12:20:07 +00:00
'require' => [
2022-04-29 12:58:38 +00:00
'Foo/Baz' => '^1.0' ,
2022-08-17 12:20:07 +00:00
],
],
[
2022-04-29 12:58:38 +00:00
'require.Foo/Baz is invalid, it should not contain uppercase characters. Please use foo/baz instead.' ,
2022-08-17 12:20:07 +00:00
],
2022-04-29 12:58:38 +00:00
false ,
2022-08-17 12:20:07 +00:00
],
2024-11-26 13:49:36 +00:00
[
[
'name' => 'a/b' ,
'license' => 'XXXXX' ,
],
[
'License "XXXXX" is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.' . PHP_EOL .
'If the software is closed-source, you may use "proprietary" as license.' ,
],
true ,
[
'name' => 'a/b' ,
'license' => [ 'XXXXX' ],
]
],
[
[
'name' => 'a/b' ,
'license' => [[ 'author' => 'bar' ], 'MIT' ],
],
[
'License {"author":"bar"} should be a string.' ,
],
true ,
[
'name' => 'a/b' ,
'license' => [ 'MIT' ],
]
],
2022-08-17 12:20:07 +00:00
];
2012-07-18 15:20:01 +00:00
}
}