1
0
Fork 0

Package options must be a non mandatory array and should be loaded when

exists
pull/2189/head
Luís Otávio Cobucci Oblonczyk 2013-08-19 04:40:08 -03:00
parent 28d0e08785
commit 8630aab93f
4 changed files with 16 additions and 0 deletions

View File

@ -193,6 +193,10 @@ class ArrayLoader implements LoaderInterface
} }
} }
if (isset($config['options'])) {
$package->setOptions($config['options']);
}
return $package; return $package;
} }

View File

@ -196,6 +196,7 @@ class ValidatingArrayLoader implements LoaderInterface
// TODO validate package repositories' packages using this recursively // TODO validate package repositories' packages using this recursively
$this->validateFlatArray('include-path'); $this->validateFlatArray('include-path');
$this->validateArray('options');
// branch alias validation // branch alias validation
if (isset($this->config['extra']['branch-alias'])) { if (isset($this->config['extra']['branch-alias'])) {

View File

@ -117,6 +117,7 @@ class ArrayLoaderTest extends \PHPUnit_Framework_TestCase
'archive' => array( 'archive' => array(
'exclude' => array('/foo/bar', 'baz', '!/foo/bar/baz'), 'exclude' => array('/foo/bar', 'baz', '!/foo/bar/baz'),
), ),
'options' => array('ssl' => array('local_cert' => '/opt/certs/test.pem'))
); );
$package = $this->loader->load($config); $package = $this->loader->load($config);

View File

@ -143,6 +143,7 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
'bin/foo', 'bin/foo',
'bin/bar', 'bin/bar',
), ),
'options' => array('ssl' => array('local_cert' => '/opt/certs/test.pem'))
), ),
), ),
array( // test as array array( // test as array
@ -256,6 +257,15 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase
'autoload : invalid value (psr0), must be one of psr-0, classmap, files' 'autoload : invalid value (psr0), must be one of psr-0, classmap, files'
) )
), ),
array(
array(
'name' => 'foo/bar',
'options' => 'test',
),
array(
'options : should be an array, string given'
)
),
); );
} }