try to fix test instead of guarding implementation
parent
7d67da3ffa
commit
873f17261c
|
@ -118,7 +118,7 @@ class ArrayDumper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($package->getTransportOptions()) && count($package->getTransportOptions()) > 0) {
|
if (count($package->getTransportOptions()) > 0) {
|
||||||
$data['transport-options'] = $package->getTransportOptions();
|
$data['transport-options'] = $package->getTransportOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$this->dumper = new ArrayDumper();
|
$this->dumper = new ArrayDumper();
|
||||||
$this->package = $this->getMock('Composer\Package\CompletePackageInterface');
|
$this->package = $this->getMock('Composer\Package\CompletePackageInterface');
|
||||||
|
$this->packageExpects('getTransportOptions', array());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRequiredInformation()
|
public function testRequiredInformation()
|
||||||
|
@ -38,7 +39,8 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
|
||||||
$this
|
$this
|
||||||
->packageExpects('getPrettyName', 'foo')
|
->packageExpects('getPrettyName', 'foo')
|
||||||
->packageExpects('getPrettyVersion', '1.0')
|
->packageExpects('getPrettyVersion', '1.0')
|
||||||
->packageExpects('getVersion', '1.0.0.0');
|
->packageExpects('getVersion', '1.0.0.0')
|
||||||
|
;
|
||||||
|
|
||||||
$config = $this->dumper->dump($this->package);
|
$config = $this->dumper->dump($this->package);
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
|
@ -56,7 +58,9 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->package = $this->getMock('Composer\Package\RootPackageInterface');
|
$this->package = $this->getMock('Composer\Package\RootPackageInterface');
|
||||||
|
|
||||||
$this
|
$this
|
||||||
->packageExpects('getMinimumStability', 'dev');
|
->packageExpects('getMinimumStability', 'dev')
|
||||||
|
->packageExpects('getTransportOptions', array())
|
||||||
|
;
|
||||||
|
|
||||||
$config = $this->dumper->dump($this->package);
|
$config = $this->dumper->dump($this->package);
|
||||||
$this->assertSame('dev', $config['minimum-stability']);
|
$this->assertSame('dev', $config['minimum-stability']);
|
||||||
|
@ -87,9 +91,15 @@ class ArrayDumperTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testKeys($key, $value, $method = null, $expectedValue = null)
|
public function testKeys($key, $value, $method = null, $expectedValue = null)
|
||||||
{
|
{
|
||||||
|
$this->package = $this->getMock('Composer\Package\RootPackageInterface');
|
||||||
|
|
||||||
$this->packageExpects('get'.ucfirst($method ?: $key), $value);
|
$this->packageExpects('get'.ucfirst($method ?: $key), $value);
|
||||||
$this->packageExpects('isAbandoned', $value);
|
$this->packageExpects('isAbandoned', $value);
|
||||||
|
|
||||||
|
if ($method !== 'transportOptions') {
|
||||||
|
$this->packageExpects('getTransportOptions', array());
|
||||||
|
}
|
||||||
|
|
||||||
$config = $this->dumper->dump($this->package);
|
$config = $this->dumper->dump($this->package);
|
||||||
|
|
||||||
$this->assertSame($expectedValue ?: $value, $config[$key]);
|
$this->assertSame($expectedValue ?: $value, $config[$key]);
|
||||||
|
|
|
@ -118,6 +118,13 @@ class LockerTest extends \PHPUnit_Framework_TestCase
|
||||||
->method('getVersion')
|
->method('getVersion')
|
||||||
->will($this->returnValue('0.1.10.0'));
|
->will($this->returnValue('0.1.10.0'));
|
||||||
|
|
||||||
|
foreach (array($package1, $package2) as $package) {
|
||||||
|
$package
|
||||||
|
->expects($this->atLeastOnce())
|
||||||
|
->method('getTransportOptions')
|
||||||
|
->will($this->returnValue(array()));
|
||||||
|
}
|
||||||
|
|
||||||
$contentHash = md5(trim($jsonContent));
|
$contentHash = md5(trim($jsonContent));
|
||||||
|
|
||||||
$json
|
$json
|
||||||
|
|
|
@ -198,18 +198,26 @@ class VersionSelectorTest extends \PHPUnit_Framework_TestCase
|
||||||
$versionParser = new VersionParser();
|
$versionParser = new VersionParser();
|
||||||
|
|
||||||
$package = $this->getMock('\Composer\Package\PackageInterface');
|
$package = $this->getMock('\Composer\Package\PackageInterface');
|
||||||
$package->expects($this->any())
|
$package
|
||||||
|
->expects($this->any())
|
||||||
->method('getPrettyVersion')
|
->method('getPrettyVersion')
|
||||||
->will($this->returnValue($prettyVersion));
|
->will($this->returnValue($prettyVersion));
|
||||||
$package->expects($this->any())
|
$package
|
||||||
|
->expects($this->any())
|
||||||
->method('getVersion')
|
->method('getVersion')
|
||||||
->will($this->returnValue($versionParser->normalize($prettyVersion)));
|
->will($this->returnValue($versionParser->normalize($prettyVersion)));
|
||||||
$package->expects($this->any())
|
$package
|
||||||
|
->expects($this->any())
|
||||||
->method('isDev')
|
->method('isDev')
|
||||||
->will($this->returnValue($isDev));
|
->will($this->returnValue($isDev));
|
||||||
$package->expects($this->any())
|
$package
|
||||||
|
->expects($this->any())
|
||||||
->method('getStability')
|
->method('getStability')
|
||||||
->will($this->returnValue($stability));
|
->will($this->returnValue($stability));
|
||||||
|
$package
|
||||||
|
->expects($this->any())
|
||||||
|
->method('getTransportOptions')
|
||||||
|
->will($this->returnValue(array()));
|
||||||
|
|
||||||
$branchAlias = $branchAlias === null ? array() : array('branch-alias' => array($prettyVersion => $branchAlias));
|
$branchAlias = $branchAlias === null ? array() : array('branch-alias' => array($prettyVersion => $branchAlias));
|
||||||
$package->expects($this->any())
|
$package->expects($this->any())
|
||||||
|
|
Loading…
Reference in New Issue