php-deb-packager/tests/wdm/debian/control/StandardFileTest.php
Jan-Hendrik Frintrop c2fa2ffd7f Fix setMaintainer (#14)
* Fix brackets of maintainer email

The email address of the maintainer must use angle brackes as per https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Maintainer
Also there should be a space between name and email.

* Use variable interpolation for maintainer name

Since you already use interpolation for maintainer email you can use it for name too.

* Fix default value for maintainer

The default value for the maintainer still had the square brackets.

* Fix tests for StandardFile

The tests still used square brackets.
2017-07-18 12:06:01 +02:00

74 lines
1.8 KiB
PHP

<?php
namespace wdm\debian\control;
class StandardFileTest extends \PHPUnit_Framework_TestCase
{
private $object;
public function setUp()
{
$this->object = new StandardFile();
}
public function testMinimumFile()
{
$conf = (string)$this->object;
$expected = <<<OEF
Version: 0.1
Section: web
Priority: optional
Architecture: all
Essential: no
Installed-Size: 1024
Maintainer: name <email>
Provides: your-company
Description: Your description
OEF;
$this->assertEquals($expected, $conf);
}
/**
* @expectedException InvalidArgumentException
* @expectedExceptionMessage Invalid property 'MyPersonalSection' for this control file.
*/
public function testFilterMissingOrInvalidProperties()
{
$this->object["MyPersonalSection"] = "Test";
}
public function testOverwriteConfiguration()
{
$this->object["Version"] = "1.0.1";
$this->object["Section"] = "Software";
$this->object["Priority"] = "security";
$this->object["Architecture"] = "x86";
$this->object["Essential"] = "yes";
$this->object["Installed-Size"] = "2048";
$this->object["Maintainer"] = "Walter Dal Mut <walter.dalmut at gmail dot com>";
$this->object["Provides"] = "Corley SRL";
$this->object["Description"] = "My Desc";
$this->object["Depends"] = "php5-cli";
$this->object["Recommends"] = "php5-curl";
$conf = (string)$this->object;
$expected = <<<OEF
Version: 1.0.1
Section: Software
Priority: security
Architecture: x86
Essential: yes
Depends: php5-cli
Recommends: php5-curl
Installed-Size: 2048
Maintainer: Walter Dal Mut <walter.dalmut at gmail dot com>
Provides: Corley SRL
Description: My Desc
OEF;
$this->assertEquals($expected, $conf);
}
}