Squashed commit of the following:

commit 3994b556dcffcde7b1801c8bc712f3127e8f8e7c
Author: John Whitley <john.whitley@berea.eu>
Date:   Tue Aug 16 09:02:53 2016 +0100

    https://github.com/composer/composer/issues/5600

    This alters the default flag for loadOptions in
    \Composer\Package\Loader\ArrayLoader to true; and alters the assumption
    of the test to reflect this change.

    **Rationale**

    The `\Composer\Package\Loader\ArrayLoader` test (defined in
    tests/Composer/Test/Package/Loader/ArrayLoaderTest.php) assumed that a
    new `\Composer\Package\Loader\ArrayLoader` instance would be always
    created with the optional flag loadOptions set to true.

    ```php
    $this->loader = new \Composer\Package\Loader\ArrayLoader(null, true);
    ```

    This change alters the general case to reflect the default assumption as
    defined in the test.

commit b75fc4ad7238bc50f724bd29446ccbc33e82c34c
Author: John Whitley <john.whitley@berea.eu>
Date:   Mon Aug 15 16:55:27 2016 +0100

    Altered the test for ArrayLoader to use the default loadConfig flag, and to test the true and false states for the loadConfig flag
main
John Whitley 8 years ago
parent f2fc70fd79
commit c51c1b3047

@ -29,7 +29,7 @@ class ArrayLoader implements LoaderInterface
protected $versionParser;
protected $loadOptions;
public function __construct(SemverVersionParser $parser = null, $loadOptions = false)
public function __construct(SemverVersionParser $parser = null, $loadOptions = true)
{
if (!$parser) {
$parser = new VersionParser;

@ -24,7 +24,7 @@ class ArrayLoaderTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
$this->loader = new ArrayLoader(null, true);
$this->loader = new ArrayLoader(null);
}
public function testSelfVersion()
@ -82,9 +82,9 @@ class ArrayLoaderTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('1.2.3.4', $package->getVersion());
}
public function testParseDump()
public function testParseDumpProvider()
{
$config = array(
$validConfig = array(
'name' => 'A/B',
'version' => '1.2.3',
'version_normalized' => '1.2.3.0',
@ -126,9 +126,55 @@ class ArrayLoaderTest extends \PHPUnit_Framework_TestCase
'abandoned' => 'foo/bar',
);
$validTestArguments = array($validConfig);
$argumentsToProvide = array($validTestArguments);
return $argumentsToProvide;
}
protected function fixConfigWhenLoadConfigIsFalse($config)
{
$expectedConfig = $config;
unset($expectedConfig['transport-options']);
return $expectedConfig;
}
/**
* The default parser should default to loading the config as this
* allows require-dev libraries to have transport options included.
*
* @dataProvider testParseDumpProvider
*/
public function testParseDumpDefaultLoadConfig($config)
{
$package = $this->loader->load($config);
$dumper = new ArrayDumper;
$this->assertEquals($config, $dumper->dump($package));
$expectedConfig = $config;
$this->assertEquals($expectedConfig, $dumper->dump($package));
}
/**
* @dataProvider testParseDumpProvider
*/
public function testParseDumpTrueLoadConfig($config)
{
$loader = new ArrayLoader(null, true);
$package = $loader->load($config);
$dumper = new ArrayDumper;
$expectedConfig = $config;
$this->assertEquals($expectedConfig, $dumper->dump($package));
}
/**
* @dataProvider testParseDumpProvider
*/
public function testParseDumpFalseLoadConfig($config)
{
$loader = new ArrayLoader(null, false);
$package = $loader->load($config);
$dumper = new ArrayDumper;
$expectedConfig = $this->fixConfigWhenLoadConfigIsFalse($config);
$this->assertEquals($expectedConfig, $dumper->dump($package));
}
public function testPackageWithBranchAlias()

Loading…
Cancel
Save