Change default deb package name (#19)

* Change default deb package name

Changed default deb package name to `"{$name}_{$version}_{$arch}.deb"` since this is what normally would be generated.

* Fix tests for default deb name

The tests with default package name still expected the old version of the name.

* Fixed tests

Tests tried to get the Control via `$this->getControl()` which obviously failed.
This commit is contained in:
Jan-Hendrik Frintrop 2017-07-18 12:07:15 +02:00 committed by Walter Dal Mut
parent fe2ad18bb3
commit 22b2fcf742
2 changed files with 19 additions and 3 deletions

View file

@ -196,7 +196,11 @@ class Packager
public function build($debPackageName = false)
{
if (!$debPackageName) {
$debPackageName = basename($this->getOutputPath() . ".deb");
$control = $this->getControl();
$name = $control['Package'];
$version = $control['Version'];
$arch = $control['Architecture'];
$debPackageName = "{$name}_{$version}_{$arch}.deb";
}
$command = "dpkg -b {$this->getOutputPath()} {$debPackageName}";

View file

@ -57,8 +57,14 @@ class PackagerTest extends \PHPUnit_Framework_TestCase
$this->object->run();
$command = $this->object->build();
$control = $this->object->getControl();
$name = $control['Package'];
$version = $control['Version'];
$arch = $control['Architecture'];
$debPackageName = "{$name}_{$version}_{$arch}.deb";
$this->assertEquals("dpkg -b vfs://root/tmp tmp.deb", $command);
$this->assertEquals("dpkg -b vfs://root/tmp {$debPackageName}", $command);
}
public function testCreateDebWhenOutputFolderIsMissing()
@ -72,8 +78,14 @@ class PackagerTest extends \PHPUnit_Framework_TestCase
$this->object->run();
$command = $this->object->build();
$control = $this->object->getControl();
$name = $control['Package'];
$version = $control['Version'];
$arch = $control['Architecture'];
$debPackageName = "{$name}_{$version}_{$arch}.deb";
$this->assertEquals("dpkg -b vfs://root/tmp tmp.deb", $command);
$this->assertEquals("dpkg -b vfs://root/tmp {$debPackageName}", $command);
}
public function testCreateDebPackageWithAnotherName()