From dab5976eb3b1df20ad39911a40d58f1800525d3c Mon Sep 17 00:00:00 2001 From: Walter Dal Mut Date: Wed, 3 Dec 2014 22:38:07 +0100 Subject: [PATCH 1/5] Added standard control file test case --- .gitignore | 2 + .travis.yml | 11 + composer.json | 5 +- composer.lock | 762 ++++++++++++++++++ tests/wdm/debian/control/StandardFileTest.php | 31 + 5 files changed, 810 insertions(+), 1 deletion(-) create mode 100644 .travis.yml create mode 100644 composer.lock create mode 100644 tests/wdm/debian/control/StandardFileTest.php diff --git a/.gitignore b/.gitignore index 67cac47..ff6c051 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ vendor *.deb src/*.tgz + +tags diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..37191d5 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: php +php: + - 5.6 + - 5.5 + - 5.4 + - 5.3 + +install: + - composer install + +script: vendor/bin/phpunit tests diff --git a/composer.json b/composer.json index 008e4e5..5d6f090 100644 --- a/composer.json +++ b/composer.json @@ -20,9 +20,12 @@ "require": { "php": ">=5.3.3" }, + "require-dev": { + "phpunit/phpunit": "~4" + }, "autoload": { "psr-0": { - "wdm": "src/" + "wdm": ["src/", "tests/"] } }, "repositories": [ diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..fe52725 --- /dev/null +++ b/composer.lock @@ -0,0 +1,762 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "b89ac83d7c4abbd18d2ada4d5e2eeae7", + "packages": [], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.0.4", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f976e5de371104877ebc89bd8fecb0019ed9c119", + "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "2.0.*@ALPHA" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Instantiator\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2014-10-13 12:58:55" + }, + { + "name": "phpunit/php-code-coverage", + "version": "2.0.13", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "0e7d2eec5554f869fa7a4ec2d21e4b37af943ea5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0e7d2eec5554f869fa7a4ec2d21e4b37af943ea5", + "reference": "0e7d2eec5554f869fa7a4ec2d21e4b37af943ea5", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.2", + "phpunit/php-token-stream": "~1.3", + "sebastian/environment": "~1.0", + "sebastian/version": "~1.0" + }, + "require-dev": { + "ext-xdebug": ">=2.1.4", + "phpunit/phpunit": "~4.1" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.2.1", + "ext-xmlwriter": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2014-12-03 06:41:44" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.3.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", + "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "File/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2013-10-10 15:34:57" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", + "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "Text/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2014-01-30 17:20:04" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c", + "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "PHP/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2013-08-02 07:42:54" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "f8d5d08c56de5cfd592b3340424a81733259a876" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/f8d5d08c56de5cfd592b3340424a81733259a876", + "reference": "f8d5d08c56de5cfd592b3340424a81733259a876", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2014-08-31 06:12:13" + }, + { + "name": "phpunit/phpunit", + "version": "4.3.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "2dab9d593997db4abcf58d0daf798eb4e9cecfe1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2dab9d593997db4abcf58d0daf798eb4e9cecfe1", + "reference": "2dab9d593997db4abcf58d0daf798eb4e9cecfe1", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.3.3", + "phpunit/php-code-coverage": "~2.0", + "phpunit/php-file-iterator": "~1.3.2", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": "~1.0.2", + "phpunit/phpunit-mock-objects": "~2.3", + "sebastian/comparator": "~1.0", + "sebastian/diff": "~1.1", + "sebastian/environment": "~1.0", + "sebastian/exporter": "~1.0", + "sebastian/version": "~1.0", + "symfony/yaml": "~2.0" + }, + "suggest": { + "phpunit/php-invoker": "~1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "", + "../../symfony/yaml/" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "http://www.phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2014-11-11 10:11:09" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "2.3.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "c63d2367247365f688544f0d500af90a11a44c65" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/c63d2367247365f688544f0d500af90a11a44c65", + "reference": "c63d2367247365f688544f0d500af90a11a44c65", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "~1.0,>=1.0.1", + "php": ">=5.3.3", + "phpunit/php-text-template": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.3" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2014-10-03 05:12:11" + }, + { + "name": "sebastian/comparator", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "e54a01c0da1b87db3c5a3c4c5277ddf331da4aef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/e54a01c0da1b87db3c5a3c4c5277ddf331da4aef", + "reference": "e54a01c0da1b87db3c5a3c4c5277ddf331da4aef", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/diff": "~1.1", + "sebastian/exporter": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2014-05-11 23:00:21" + }, + { + "name": "sebastian/diff", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "5843509fed39dee4b356a306401e9dd1a931fec7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/5843509fed39dee4b356a306401e9dd1a931fec7", + "reference": "5843509fed39dee4b356a306401e9dd1a931fec7", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "http://www.github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2014-08-15 10:29:00" + }, + { + "name": "sebastian/environment", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "6e6c71d918088c251b181ba8b3088af4ac336dd7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e6c71d918088c251b181ba8b3088af4ac336dd7", + "reference": "6e6c71d918088c251b181ba8b3088af4ac336dd7", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2014-10-25 08:00:45" + }, + { + "name": "sebastian/exporter", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "c7d59948d6e82818e1bdff7cadb6c34710eb7dc0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c7d59948d6e82818e1bdff7cadb6c34710eb7dc0", + "reference": "c7d59948d6e82818e1bdff7cadb6c34710eb7dc0", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2014-09-10 00:51:36" + }, + { + "name": "sebastian/version", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43", + "reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43", + "shasum": "" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2014-03-07 15:35:33" + }, + { + "name": "symfony/yaml", + "version": "v2.6.1", + "target-dir": "Symfony/Component/Yaml", + "source": { + "type": "git", + "url": "https://github.com/symfony/Yaml.git", + "reference": "3346fc090a3eb6b53d408db2903b241af51dcb20" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/3346fc090a3eb6b53d408db2903b241af51dcb20", + "reference": "3346fc090a3eb6b53d408db2903b241af51dcb20", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Yaml\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Yaml Component", + "homepage": "http://symfony.com", + "time": "2014-12-02 20:19:20" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "platform": { + "php": ">=5.3.3" + }, + "platform-dev": [] +} diff --git a/tests/wdm/debian/control/StandardFileTest.php b/tests/wdm/debian/control/StandardFileTest.php new file mode 100644 index 0000000..4b6e5ec --- /dev/null +++ b/tests/wdm/debian/control/StandardFileTest.php @@ -0,0 +1,31 @@ +object = new StandardFile(); + } + + public function testMinimumFile() + { + $conf = (string)$this->object; + + $expected = <<assertEquals($expected, $conf); + } +} From 0dfd2369255045423d1cffdb40c009042019d7cc Mon Sep 17 00:00:00 2001 From: Walter Dal Mut Date: Wed, 3 Dec 2014 22:39:53 +0100 Subject: [PATCH 2/5] Removed window file new lines and extra spaces --- src/wdm/debian/control/StandardFile.php | 30 ++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/wdm/debian/control/StandardFile.php b/src/wdm/debian/control/StandardFile.php index 89767e2..2843904 100644 --- a/src/wdm/debian/control/StandardFile.php +++ b/src/wdm/debian/control/StandardFile.php @@ -91,9 +91,9 @@ class StandardFile return $this->_setProperty("Pre-Depends", $this->_transformList($depends)); } - public function setRecommends($depends) - { - return $this->_setProperty("Reccommends", $depends); + public function setRecommends($depends) + { + return $this->_setProperty("Reccommends", $depends); } public function setSuggests($depends) @@ -134,10 +134,10 @@ class StandardFile private function _transformList($depends) { - if (is_array($depends)) { - $depends = implode(", ", $depends); - } else { - $depends = $depends; + if (is_array($depends)) { + $depends = implode(", ", $depends); + } else { + $depends = $depends; } return $depends; @@ -150,28 +150,28 @@ class StandardFile } public function offsetExists ($offset) { - return array_key_exists($offset, $this->_keys); - } + return array_key_exists($offset, $this->_keys); + } public function offsetGet ($offset) { if ($this->offsetExists($offset)) { return $this->_keys[$offset]; } else { return null; - } - } - + } + } + public function offsetSet ($offset, $value) { if (!$this->offsetExists($offset)) { throw new \Exception("Invalid property for this control file."); } - $this->_keys[$offset] = $value; - } + $this->_keys[$offset] = $value; + } public function offsetUnset ($offset) { if ($this->offsetExists($offset)) { unset($this->_keys[$offset]); - } + } } /** From 529a529185d7d6bf38578e18d79807b70bf53014 Mon Sep 17 00:00:00 2001 From: Walter Dal Mut Date: Wed, 3 Dec 2014 22:41:32 +0100 Subject: [PATCH 3/5] Cover filter out extra properties --- src/wdm/debian/control/StandardFile.php | 2 +- tests/wdm/debian/control/StandardFileTest.php | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/wdm/debian/control/StandardFile.php b/src/wdm/debian/control/StandardFile.php index 2843904..cf61145 100644 --- a/src/wdm/debian/control/StandardFile.php +++ b/src/wdm/debian/control/StandardFile.php @@ -163,7 +163,7 @@ class StandardFile public function offsetSet ($offset, $value) { if (!$this->offsetExists($offset)) { - throw new \Exception("Invalid property for this control file."); + throw new \InvalidArgumentException("Invalid property for this control file."); } $this->_keys[$offset] = $value; } diff --git a/tests/wdm/debian/control/StandardFileTest.php b/tests/wdm/debian/control/StandardFileTest.php index 4b6e5ec..e85c1dd 100644 --- a/tests/wdm/debian/control/StandardFileTest.php +++ b/tests/wdm/debian/control/StandardFileTest.php @@ -28,4 +28,12 @@ Description: Your description OEF; $this->assertEquals($expected, $conf); } + + /** + * @expectedException InvalidArgumentException + */ + public function testFilterMissingOrInvalidProperties() + { + $this->object["MyPersonalSection"] = "Test"; + } } From f097b8cf31201621c15b9ecbee1e1f172179674b Mon Sep 17 00:00:00 2001 From: Walter Dal Mut Date: Wed, 3 Dec 2014 22:48:17 +0100 Subject: [PATCH 4/5] Cover base configuration overwrite --- src/wdm/debian/control/StandardFile.php | 2 +- tests/wdm/debian/control/StandardFileTest.php | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/wdm/debian/control/StandardFile.php b/src/wdm/debian/control/StandardFile.php index cf61145..7092840 100644 --- a/src/wdm/debian/control/StandardFile.php +++ b/src/wdm/debian/control/StandardFile.php @@ -163,7 +163,7 @@ class StandardFile public function offsetSet ($offset, $value) { if (!$this->offsetExists($offset)) { - throw new \InvalidArgumentException("Invalid property for this control file."); + throw new \InvalidArgumentException("Invalid property '{$offset}' for this control file."); } $this->_keys[$offset] = $value; } diff --git a/tests/wdm/debian/control/StandardFileTest.php b/tests/wdm/debian/control/StandardFileTest.php index e85c1dd..81b539a 100644 --- a/tests/wdm/debian/control/StandardFileTest.php +++ b/tests/wdm/debian/control/StandardFileTest.php @@ -31,9 +31,43 @@ OEF; /** * @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 = <<assertEquals($expected, $conf); + } } From 0c2ba5071d54345d767d35d5b6d9cdab75db6c9a Mon Sep 17 00:00:00 2001 From: Walter Dal Mut Date: Wed, 3 Dec 2014 23:24:42 +0100 Subject: [PATCH 5/5] BC Break packager - Simplifies packager maintenance --- CHANGELOG-0.0.4.md | 3 ++ README.md | 15 ++++++-- src/example.php => example.php | 4 +- src/package.xml | 62 ------------------------------- src/wdm/debian/Packager.php | 4 +- tests/wdm/debian/PackagerTest.php | 17 +++++++++ 6 files changed, 35 insertions(+), 70 deletions(-) create mode 100644 CHANGELOG-0.0.4.md rename src/example.php => example.php (91%) delete mode 100644 src/package.xml create mode 100644 tests/wdm/debian/PackagerTest.php diff --git a/CHANGELOG-0.0.4.md b/CHANGELOG-0.0.4.md new file mode 100644 index 0000000..8b53ee2 --- /dev/null +++ b/CHANGELOG-0.0.4.md @@ -0,0 +1,3 @@ +# BC Breaks + +* Build will returns the dpkg command instead print it to the user diff --git a/README.md b/README.md index 4d0c0c7..71bab00 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,16 @@ $packager->mount("/path/to/docs", "/usr/share/docs"); //Creates folders using mount points $packager->run(); -//Creates the Debian package -$packager->build(); +//Get the Debian package command +echo $packager->build(); ``` + +**Create the Package** + +``` +$(php pack.php) +``` + ## Pre-Post scripts Optianally you can add script for different hooks @@ -45,7 +52,7 @@ Optianally you can add script for different hooks * Run pre package remove * post-remove * Run post package remove - + Adding scripts ```php @@ -67,4 +74,4 @@ echo "Goodbye Cruel World" exit 0 ``` - + diff --git a/src/example.php b/example.php similarity index 91% rename from src/example.php rename to example.php index 00cd7e6..61e952b 100644 --- a/src/example.php +++ b/example.php @@ -23,5 +23,5 @@ $packager->mount(__DIR__ . "/../../diff", "/my-differ"); //Creates folders using mount points $packager->run(); -//Creates the Debian package -$packager->build(); \ No newline at end of file +//Get the Debian package command +echo $packager->build(); diff --git a/src/package.xml b/src/package.xml deleted file mode 100644 index a701ff0..0000000 --- a/src/package.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - Corley_Deb_Packager - pear.corley.it - Corley DEB packager. - - This library provides mechanisms for generate valid .deb files useful - for software distribution for GNU/Linux Debian based systems. - - - Walter Dal Mut - wdalmut - walter.dalmut at corley.it - yes - - - Gabriele Mittica - gmittica - gabriele.mittica at corley.it - yes - - 2012-06-04 - - - 0.0.3 - 0.0.3 - - - alpha - alpha - - MIT - In this release the first proposal. - - - - - - - - - - - - - - - - - - 5.3.3 - - - 1.4.0 - - - - - diff --git a/src/wdm/debian/Packager.php b/src/wdm/debian/Packager.php index 3299e22..9f2a40b 100644 --- a/src/wdm/debian/Packager.php +++ b/src/wdm/debian/Packager.php @@ -192,8 +192,8 @@ class Packager $debPackageName = basename($this->_outputPath . ".deb"); } - $command = "dpkg -b {$this->_outputPath} {$debPackageName}" . PHP_EOL; + $command = "dpkg -b {$this->_outputPath} {$debPackageName}"; - echo $command; + return $command; } } diff --git a/tests/wdm/debian/PackagerTest.php b/tests/wdm/debian/PackagerTest.php new file mode 100644 index 0000000..8c6bb0e --- /dev/null +++ b/tests/wdm/debian/PackagerTest.php @@ -0,0 +1,17 @@ +object = new Packager(); + } + + public function testRetrieveTheBuildCommand() + { + $this->object->setOutputPath("/tmp"); + + $this->assertEquals("dpkg -b /tmp my.deb", $this->object->build("my.deb")); + } +}