From 242345aabde18c9f86dff72b867ae056c2ddffa2 Mon Sep 17 00:00:00 2001 From: Julien Guittard Date: Thu, 9 Jun 2016 14:25:18 +0200 Subject: [PATCH] Added config file type handling --- composer.lock | 390 ++++++++--------------------------- src/Task/LoadConfigTask.php | 62 +++++- tests/LoadConfigTaskTest.php | 16 +- 3 files changed, 158 insertions(+), 310 deletions(-) diff --git a/composer.lock b/composer.lock index 5f60976..e8d0a25 100644 --- a/composer.lock +++ b/composer.lock @@ -4,21 +4,21 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "c2be5c1988c3d879d395828cd02ad928", - "content-hash": "f1faa13a7153607b88380769f28cfd12", + "hash": "1072d88563e97f51d351a63378c1ec30", + "content-hash": "589950844e0c77abb7feaf2929efb4d0", "packages": [ { "name": "guzzlehttp/guzzle", - "version": "6.1.1", + "version": "6.2.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "c6851d6e48f63b69357cbfa55bca116448140e0c" + "reference": "d094e337976dff9d8e2424e8485872194e768662" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/c6851d6e48f63b69357cbfa55bca116448140e0c", - "reference": "c6851d6e48f63b69357cbfa55bca116448140e0c", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d094e337976dff9d8e2424e8485872194e768662", + "reference": "d094e337976dff9d8e2424e8485872194e768662", "shasum": "" }, "require": { @@ -34,7 +34,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.1-dev" + "dev-master": "6.2-dev" } }, "autoload": { @@ -67,20 +67,20 @@ "rest", "web service" ], - "time": "2015-11-23 00:47:50" + "time": "2016-03-21 20:02:09" }, { "name": "guzzlehttp/promises", - "version": "1.0.3", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "b1e1c0d55f8083c71eda2c28c12a228d708294ea" + "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/b1e1c0d55f8083c71eda2c28c12a228d708294ea", - "reference": "b1e1c0d55f8083c71eda2c28c12a228d708294ea", + "url": "https://api.github.com/repos/guzzle/promises/zipball/c10d860e2a9595f8883527fa0021c7da9e65f579", + "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579", "shasum": "" }, "require": { @@ -118,20 +118,20 @@ "keywords": [ "promise" ], - "time": "2015-10-15 22:28:00" + "time": "2016-05-18 16:56:05" }, { "name": "guzzlehttp/psr7", - "version": "1.2.2", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "f5d04bdd2881ac89abde1fb78cc234bce24327bb" + "reference": "31382fef2889136415751badebbd1cb022a4ed72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5d04bdd2881ac89abde1fb78cc234bce24327bb", - "reference": "f5d04bdd2881ac89abde1fb78cc234bce24327bb", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/31382fef2889136415751badebbd1cb022a4ed72", + "reference": "31382fef2889136415751badebbd1cb022a4ed72", "shasum": "" }, "require": { @@ -176,20 +176,20 @@ "stream", "uri" ], - "time": "2016-01-23 01:23:02" + "time": "2016-04-13 19:56:01" }, { "name": "phing/phing", - "version": "2.13.0", + "version": "2.14.0", "source": { "type": "git", "url": "https://github.com/phingofficial/phing.git", - "reference": "a5b10a50160c8a4744545aacb33ef158349e655c" + "reference": "7dd73c83c377623def54b58121f46b4dcb35dd61" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phingofficial/phing/zipball/a5b10a50160c8a4744545aacb33ef158349e655c", - "reference": "a5b10a50160c8a4744545aacb33ef158349e655c", + "url": "https://api.github.com/repos/phingofficial/phing/zipball/7dd73c83c377623def54b58121f46b4dcb35dd61", + "reference": "7dd73c83c377623def54b58121f46b4dcb35dd61", "shasum": "" }, "require": { @@ -198,6 +198,7 @@ "require-dev": { "ext-pdo_sqlite": "*", "lastcraft/simpletest": "@dev", + "mikey179/vfsstream": "^1.6", "pdepend/pdepend": "2.x", "pear/archive_tar": "1.4.x", "pear/http_request2": "dev-trunk", @@ -233,7 +234,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.13.x-dev" + "dev-master": "2.14.x-dev" } }, "autoload": { @@ -266,7 +267,7 @@ "task", "tool" ], - "time": "2015-12-04 09:45:44" + "time": "2016-03-10 21:39:23" }, { "name": "psr/http-message", @@ -319,169 +320,6 @@ } ], "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", - "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" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "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": "2015-06-14 21:17:01" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "suggest": { - "dflydev/markdown": "~1.0", - "erusev/parsedown": "~1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "phpDocumentor": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" - } - ], - "time": "2015-02-03 12:10:50" - }, - { - "name": "phpspec/prophecy", - "version": "v1.5.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7", - "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "phpdocumentor/reflection-docblock": "~2.0", - "sebastian/comparator": "~1.1" - }, - "require-dev": { - "phpspec/phpspec": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "psr-0": { - "Prophecy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2015-08-13 10:07:40" - }, { "name": "phpunit/php-code-coverage", "version": "2.2.4", @@ -546,33 +384,31 @@ }, { "name": "phpunit/php-file-iterator", - "version": "1.4.1", + "version": "1.3.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" + "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", + "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", "shasum": "" }, "require": { "php": ">=5.3.3" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, "autoload": { "classmap": [ - "src/" + "File/" ] }, "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], "license": [ "BSD-3-Clause" ], @@ -589,7 +425,7 @@ "filesystem", "iterator" ], - "time": "2015-06-21 13:08:43" + "time": "2013-10-10 15:34:57" }, { "name": "phpunit/php-text-template", @@ -634,21 +470,24 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.7", + "version": "1.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", "shasum": "" }, "require": { "php": ">=5.3.3" }, + "require-dev": { + "phpunit/phpunit": "~4|~5" + }, "type": "library", "autoload": { "classmap": [ @@ -671,7 +510,7 @@ "keywords": [ "timer" ], - "time": "2015-06-21 08:01:12" + "time": "2016-05-12 18:03:57" }, { "name": "phpunit/php-token-stream", @@ -724,16 +563,16 @@ }, { "name": "phpunit/phpunit", - "version": "4.8.21", + "version": "4.1.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "ea76b17bced0500a28098626b84eda12dbcf119c" + "reference": "241116219bb7e3b8111a36ffd8f37546888738d6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ea76b17bced0500a28098626b84eda12dbcf119c", - "reference": "ea76b17bced0500a28098626b84eda12dbcf119c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/241116219bb7e3b8111a36ffd8f37546888738d6", + "reference": "241116219bb7e3b8111a36ffd8f37546888738d6", "shasum": "" }, "require": { @@ -743,19 +582,17 @@ "ext-reflection": "*", "ext-spl": "*", "php": ">=5.3.3", - "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "~2.1", - "phpunit/php-file-iterator": "~1.4", + "phpunit/php-code-coverage": "~2.0", + "phpunit/php-file-iterator": "~1.3.1", "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": ">=1.0.6", - "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.1", - "sebastian/diff": "~1.2", - "sebastian/environment": "~1.3", - "sebastian/exporter": "~1.2", - "sebastian/global-state": "~1.0", + "phpunit/php-timer": "~1.0.2", + "phpunit/phpunit-mock-objects": "2.1.5", + "sebastian/comparator": "~1.0", + "sebastian/diff": "~1.1", + "sebastian/environment": "~1.0", + "sebastian/exporter": "~1.0", "sebastian/version": "~1.0", - "symfony/yaml": "~2.1|~3.0" + "symfony/yaml": "~2.0" }, "suggest": { "phpunit/php-invoker": "~1.1" @@ -766,7 +603,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.8.x-dev" + "dev-master": "4.1.x-dev" } }, "autoload": { @@ -775,6 +612,10 @@ ] }, "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "", + "../../symfony/yaml/" + ], "license": [ "BSD-3-Clause" ], @@ -786,36 +627,34 @@ } ], "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", + "homepage": "http://www.phpunit.de/", "keywords": [ "phpunit", "testing", "xunit" ], - "time": "2015-12-12 07:45:58" + "time": "2014-08-17 08:07:02" }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.8", + "version": "2.1.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + "reference": "7878b9c41edb3afab92b85edf5f0981014a2713a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/7878b9c41edb3afab92b85edf5f0981014a2713a", + "reference": "7878b9c41edb3afab92b85edf5f0981014a2713a", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" + "phpunit/php-text-template": "~1.2" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "~4.1" }, "suggest": { "ext-soap": "*" @@ -823,7 +662,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3.x-dev" + "dev-master": "2.1.x-dev" } }, "autoload": { @@ -832,6 +671,9 @@ ] }, "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], "license": [ "BSD-3-Clause" ], @@ -848,7 +690,7 @@ "mock", "xunit" ], - "time": "2015-10-02 06:51:40" + "time": "2014-06-12 07:22:15" }, { "name": "sebastian/comparator", @@ -968,16 +810,16 @@ }, { "name": "sebastian/environment", - "version": "1.3.3", + "version": "1.3.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "6e7133793a8e5a5714a551a8324337374be209df" + "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6e7133793a8e5a5714a551a8324337374be209df", - "reference": "6e7133793a8e5a5714a551a8324337374be209df", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716", + "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716", "shasum": "" }, "require": { @@ -1014,7 +856,7 @@ "environment", "hhvm" ], - "time": "2015-12-02 08:37:27" + "time": "2016-05-17 03:18:57" }, { "name": "sebastian/exporter", @@ -1082,57 +924,6 @@ ], "time": "2015-06-21 07:55:53" }, - { - "name": "sebastian/global-state", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2015-10-12 03:26:01" - }, { "name": "sebastian/recursion-context", "version": "1.0.2", @@ -1223,19 +1014,20 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "2.5.1", + "version": "2.6.1", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "6731851d6aaf1d0d6c58feff1065227b7fda3ba8" + "reference": "fb72ed32f8418db5e7770be1653e62e0d6f5dd3d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6731851d6aaf1d0d6c58feff1065227b7fda3ba8", - "reference": "6731851d6aaf1d0d6c58feff1065227b7fda3ba8", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/fb72ed32f8418db5e7770be1653e62e0d6f5dd3d", + "reference": "fb72ed32f8418db5e7770be1653e62e0d6f5dd3d", "shasum": "" }, "require": { + "ext-simplexml": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", "php": ">=5.1.2" @@ -1296,29 +1088,29 @@ "phpcs", "standards" ], - "time": "2016-01-19 23:39:10" + "time": "2016-05-30 22:24:32" }, { "name": "symfony/yaml", - "version": "v3.0.1", + "version": "v2.8.7", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "3df409958a646dad2bc5046c3fb671ee24a1a691" + "reference": "815fabf3f48c7d1df345a69d1ad1a88f59757b34" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/3df409958a646dad2bc5046c3fb671ee24a1a691", - "reference": "3df409958a646dad2bc5046c3fb671ee24a1a691", + "url": "https://api.github.com/repos/symfony/yaml/zipball/815fabf3f48c7d1df345a69d1ad1a88f59757b34", + "reference": "815fabf3f48c7d1df345a69d1ad1a88f59757b34", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": ">=5.3.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "2.8-dev" } }, "autoload": { @@ -1345,7 +1137,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2015-12-26 13:39:53" + "time": "2016-06-06 11:11:27" } ], "aliases": [], diff --git a/src/Task/LoadConfigTask.php b/src/Task/LoadConfigTask.php index 6151c7c..116b08f 100644 --- a/src/Task/LoadConfigTask.php +++ b/src/Task/LoadConfigTask.php @@ -13,11 +13,21 @@ */ class LoadConfigTask extends Task { + const TYPE_INI = 'ini'; + const TYPE_JSON = 'json'; + + protected $availableTypes = ['ini', 'json']; + /** * @var string */ protected $fromFile; + /** + * @var string + */ + protected $type; + /** * @var string */ @@ -40,6 +50,21 @@ public function setFromFile($fromFile) return $this; } + /** + * Set the type + * + * @param string $type + * @return LoadConfigTask + */ + public function setType($type) + { + if (!in_array($type, $this->availableTypes)) { + throw new \InvalidArgumentException(sprintf('%s is not a valid config file type', $type)); + } + $this->type = strtolower($type); + return $this; + } + /** * Set the toProperty * @@ -75,25 +100,42 @@ public function main() if (empty($this->fromFile)) { throw new \Exception('File path must be set to load config'); } - $wait = $this->wait ?: 5; - for ($i=0; $i<10; $i++) { - if (!file_exists($this->fromFile)) { - sleep($wait); - continue; + if ($this->wait) { + for ($i=0; $i<10; $i++) { + if (!file_exists($this->fromFile)) { + sleep($this->wait); + continue; + } + break; } - break; } if (!file_exists($this->fromFile)) { throw new \Exception('File path must exist to load config'); } - $content = file_get_contents($this->fromFile); - $config = json_decode($content, true); - if (!$config) { - throw new \Exception('File content must be valid JSON'); + + if (false === ($config = $this->loadConfig())) { + throw new \Exception(sprintf('Invalid %s type content', strtoupper($this->type))); } foreach ($config as $key => $value) { $this->project->setNewProperty($this->toProperty .$key, $value); } } + /** + * @return array|bool|mixed + */ + protected function loadConfig() + { + $config = false; + switch ($this->type) { + case self::TYPE_INI: + $config = parse_ini_file($this->fromFile, null, 2); + break; + case self::TYPE_JSON: + $content = file_get_contents($this->fromFile); + $config = json_decode($content, true); + break; + } + return $config; + } } \ No newline at end of file diff --git a/tests/LoadConfigTaskTest.php b/tests/LoadConfigTaskTest.php index de1a79a..4c688a4 100644 --- a/tests/LoadConfigTaskTest.php +++ b/tests/LoadConfigTaskTest.php @@ -53,10 +53,24 @@ public function testToPropertySetter() * * @return void */ - public function waitPropertySetter() + public function testWaitSetter() { $wait = 5; $this->assertSame($this->task, $this->task->setWait($wait)); $this->assertAttributeSame($wait, 'wait', $this->task); } + + public function testTypeSetter() + { + $type = 'ini'; + $this->assertSame($this->task, $this->task->setType($type)); + $this->assertAttributeSame($type, 'type', $this->task); + } + + public function testInvalidTypeThrowsException() + { + $type = 'foo'; + $this->setExpectedException('InvalidArgumentException'); + $this->task->setType($type); + } } \ No newline at end of file