diff --git a/composer.json b/composer.json
index b3a6b6a..c4bfc5c 100644
--- a/composer.json
+++ b/composer.json
@@ -20,6 +20,9 @@
"symfony/yaml": "^3.0",
"symfony/process": "^3.0"
},
+ "require-dev": {
+ "phpunit/phpunit": "5.5.*"
+ },
"autoload": {
"psr-4": {
"Mage\\": "src/Mage/"
diff --git a/composer.lock b/composer.lock
index 78d4185..5b8546f 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,8 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "hash": "f6ccc11344faf8455f9ad7e47093d05a",
- "content-hash": "9af180a8e49a2a08013cb76345fde19b",
+ "content-hash": "8a9206b3fdd841ffde833118849a6a76",
"packages": [
{
"name": "monolog/monolog",
@@ -83,7 +82,7 @@
"logging",
"psr-3"
],
- "time": "2016-11-26 00:15:39"
+ "time": "2016-11-26T00:15:39+00:00"
},
{
"name": "psr/log",
@@ -130,7 +129,7 @@
"psr",
"psr-3"
],
- "time": "2016-10-10 12:19:37"
+ "time": "2016-10-10T12:19:37+00:00"
},
{
"name": "symfony/console",
@@ -193,7 +192,7 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
- "time": "2016-12-11 14:34:22"
+ "time": "2016-12-11T14:34:22+00:00"
},
{
"name": "symfony/debug",
@@ -250,7 +249,7 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
- "time": "2016-11-16 22:18:16"
+ "time": "2016-11-16T22:18:16+00:00"
},
{
"name": "symfony/filesystem",
@@ -299,7 +298,7 @@
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
- "time": "2016-11-24 00:46:43"
+ "time": "2016-11-24T00:46:43+00:00"
},
{
"name": "symfony/finder",
@@ -348,7 +347,7 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
- "time": "2016-12-13 09:39:43"
+ "time": "2016-12-13T09:39:43+00:00"
},
{
"name": "symfony/polyfill-mbstring",
@@ -407,7 +406,7 @@
"portable",
"shim"
],
- "time": "2016-11-14 01:06:16"
+ "time": "2016-11-14T01:06:16+00:00"
},
{
"name": "symfony/process",
@@ -456,7 +455,7 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
- "time": "2016-11-24 10:40:28"
+ "time": "2016-11-24T10:40:28+00:00"
},
{
"name": "symfony/yaml",
@@ -511,10 +510,1260 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
- "time": "2016-12-10 10:07:06"
+ "time": "2016-12-10T10:07:06+00:00"
+ }
+ ],
+ "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-14T21:17:01+00:00"
+ },
+ {
+ "name": "myclabs/deep-copy",
+ "version": "1.5.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/myclabs/DeepCopy.git",
+ "reference": "399c1f9781e222f6eb6cc238796f5200d1b7f108"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/399c1f9781e222f6eb6cc238796f5200d1b7f108",
+ "reference": "399c1f9781e222f6eb6cc238796f5200d1b7f108",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.4.0"
+ },
+ "require-dev": {
+ "doctrine/collections": "1.*",
+ "phpunit/phpunit": "~4.1"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "DeepCopy\\": "src/DeepCopy/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "Create deep copies (clones) of your objects",
+ "homepage": "https://github.com/myclabs/DeepCopy",
+ "keywords": [
+ "clone",
+ "copy",
+ "duplicate",
+ "object",
+ "object graph"
+ ],
+ "time": "2016-10-31T17:19:45+00:00"
+ },
+ {
+ "name": "phpdocumentor/reflection-common",
+ "version": "1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpDocumentor/ReflectionCommon.git",
+ "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
+ "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.6"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "phpDocumentor\\Reflection\\": [
+ "src"
+ ]
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jaap van Otterdijk",
+ "email": "opensource@ijaap.nl"
+ }
+ ],
+ "description": "Common reflection classes used by phpdocumentor to reflect the code structure",
+ "homepage": "http://www.phpdoc.org",
+ "keywords": [
+ "FQSEN",
+ "phpDocumentor",
+ "phpdoc",
+ "reflection",
+ "static analysis"
+ ],
+ "time": "2015-12-27T11:43:31+00:00"
+ },
+ {
+ "name": "phpdocumentor/reflection-docblock",
+ "version": "3.1.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
+ "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e",
+ "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5",
+ "phpdocumentor/reflection-common": "^1.0@dev",
+ "phpdocumentor/type-resolver": "^0.2.0",
+ "webmozart/assert": "^1.0"
+ },
+ "require-dev": {
+ "mockery/mockery": "^0.9.4",
+ "phpunit/phpunit": "^4.4"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "phpDocumentor\\Reflection\\": [
+ "src/"
+ ]
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Mike van Riel",
+ "email": "me@mikevanriel.com"
+ }
+ ],
+ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
+ "time": "2016-09-30T07:12:33+00:00"
+ },
+ {
+ "name": "phpdocumentor/type-resolver",
+ "version": "0.2.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpDocumentor/TypeResolver.git",
+ "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb",
+ "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5",
+ "phpdocumentor/reflection-common": "^1.0"
+ },
+ "require-dev": {
+ "mockery/mockery": "^0.9.4",
+ "phpunit/phpunit": "^5.2||^4.8.24"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "phpDocumentor\\Reflection\\": [
+ "src/"
+ ]
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Mike van Riel",
+ "email": "me@mikevanriel.com"
+ }
+ ],
+ "time": "2016-11-25T06:54:22+00:00"
+ },
+ {
+ "name": "phpspec/prophecy",
+ "version": "v1.6.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpspec/prophecy.git",
+ "reference": "6c52c2722f8460122f96f86346600e1077ce22cb"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpspec/prophecy/zipball/6c52c2722f8460122f96f86346600e1077ce22cb",
+ "reference": "6c52c2722f8460122f96f86346600e1077ce22cb",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/instantiator": "^1.0.2",
+ "php": "^5.3|^7.0",
+ "phpdocumentor/reflection-docblock": "^2.0|^3.0.2",
+ "sebastian/comparator": "^1.1",
+ "sebastian/recursion-context": "^1.0|^2.0"
+ },
+ "require-dev": {
+ "phpspec/phpspec": "^2.0",
+ "phpunit/phpunit": "^4.8 || ^5.6.5"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.6.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": "2016-11-21T14:58:47+00:00"
+ },
+ {
+ "name": "phpunit/php-code-coverage",
+ "version": "4.0.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
+ "reference": "c14196e64a78570034afd0b7a9f3757ba71c2a0a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c14196e64a78570034afd0b7a9f3757ba71c2a0a",
+ "reference": "c14196e64a78570034afd0b7a9f3757ba71c2a0a",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.6 || ^7.0",
+ "phpunit/php-file-iterator": "~1.3",
+ "phpunit/php-text-template": "~1.2",
+ "phpunit/php-token-stream": "^1.4.2",
+ "sebastian/code-unit-reverse-lookup": "~1.0",
+ "sebastian/environment": "^1.3.2 || ^2.0",
+ "sebastian/version": "~1.0|~2.0"
+ },
+ "require-dev": {
+ "ext-xdebug": ">=2.1.4",
+ "phpunit/phpunit": "^5.4"
+ },
+ "suggest": {
+ "ext-dom": "*",
+ "ext-xdebug": ">=2.4.0",
+ "ext-xmlwriter": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.0.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": "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": "2016-12-20T15:22:42+00:00"
+ },
+ {
+ "name": "phpunit/php-file-iterator",
+ "version": "1.4.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-file-iterator.git",
+ "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5",
+ "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4.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": "FilterIterator implementation that filters files based on a list of suffixes.",
+ "homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
+ "keywords": [
+ "filesystem",
+ "iterator"
+ ],
+ "time": "2016-10-03T07:40:28+00:00"
+ },
+ {
+ "name": "phpunit/php-text-template",
+ "version": "1.2.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-text-template.git",
+ "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
+ "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "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": "Simple template engine.",
+ "homepage": "https://github.com/sebastianbergmann/php-text-template/",
+ "keywords": [
+ "template"
+ ],
+ "time": "2015-06-21T13:50:34+00:00"
+ },
+ {
+ "name": "phpunit/php-timer",
+ "version": "1.0.8",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-timer.git",
+ "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260"
+ },
+ "dist": {
+ "type": "zip",
+ "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": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "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": "2016-05-12T18:03:57+00:00"
+ },
+ {
+ "name": "phpunit/php-token-stream",
+ "version": "1.4.9",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-token-stream.git",
+ "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3b402f65a4cc90abf6e1104e388b896ce209631b",
+ "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b",
+ "shasum": ""
+ },
+ "require": {
+ "ext-tokenizer": "*",
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4-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": "2016-11-15T14:06:22+00:00"
+ },
+ {
+ "name": "phpunit/phpunit",
+ "version": "5.5.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/phpunit.git",
+ "reference": "3e6e88e56c912133de6e99b87728cca7ed70c5f5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3e6e88e56c912133de6e99b87728cca7ed70c5f5",
+ "reference": "3e6e88e56c912133de6e99b87728cca7ed70c5f5",
+ "shasum": ""
+ },
+ "require": {
+ "ext-dom": "*",
+ "ext-json": "*",
+ "ext-pcre": "*",
+ "ext-reflection": "*",
+ "ext-spl": "*",
+ "myclabs/deep-copy": "~1.3",
+ "php": "^5.6 || ^7.0",
+ "phpspec/prophecy": "^1.3.1",
+ "phpunit/php-code-coverage": "^4.0.1",
+ "phpunit/php-file-iterator": "~1.4",
+ "phpunit/php-text-template": "~1.2",
+ "phpunit/php-timer": "^1.0.6",
+ "phpunit/phpunit-mock-objects": "^3.2",
+ "sebastian/comparator": "~1.1",
+ "sebastian/diff": "~1.2",
+ "sebastian/environment": "^1.3 || ^2.0",
+ "sebastian/exporter": "~1.2",
+ "sebastian/global-state": "~1.0",
+ "sebastian/object-enumerator": "~1.0",
+ "sebastian/resource-operations": "~1.0",
+ "sebastian/version": "~1.0|~2.0",
+ "symfony/yaml": "~2.1|~3.0"
+ },
+ "conflict": {
+ "phpdocumentor/reflection-docblock": "3.0.2"
+ },
+ "suggest": {
+ "phpunit/php-invoker": "~1.1"
+ },
+ "bin": [
+ "phpunit"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "5.5.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "The PHP Unit Testing framework.",
+ "homepage": "https://phpunit.de/",
+ "keywords": [
+ "phpunit",
+ "testing",
+ "xunit"
+ ],
+ "time": "2016-08-26T07:11:44+00:00"
+ },
+ {
+ "name": "phpunit/phpunit-mock-objects",
+ "version": "3.4.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
+ "reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3ab72b65b39b491e0c011e2e09bb2206c2aa8e24",
+ "reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/instantiator": "^1.0.2",
+ "php": "^5.6 || ^7.0",
+ "phpunit/php-text-template": "^1.2",
+ "sebastian/exporter": "^1.2 || ^2.0"
+ },
+ "conflict": {
+ "phpunit/phpunit": "<5.4.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^5.4"
+ },
+ "suggest": {
+ "ext-soap": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.2.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": "2016-12-08T20:27:08+00:00"
+ },
+ {
+ "name": "sebastian/code-unit-reverse-lookup",
+ "version": "1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git",
+ "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/c36f5e7cfce482fde5bf8d10d41a53591e0198fe",
+ "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.6"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~5"
+ },
+ "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": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Looks up which function or method a line of code belongs to",
+ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
+ "time": "2016-02-13T06:45:14+00:00"
+ },
+ {
+ "name": "sebastian/comparator",
+ "version": "1.2.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/comparator.git",
+ "reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/6a1ed12e8b2409076ab22e3897126211ff8b1f7f",
+ "reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "sebastian/diff": "~1.2",
+ "sebastian/exporter": "~1.2 || ~2.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "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": "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": "2016-11-19T09:18:40+00:00"
+ },
+ {
+ "name": "sebastian/diff",
+ "version": "1.4.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/diff.git",
+ "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e",
+ "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.8"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.4-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": "https://github.com/sebastianbergmann/diff",
+ "keywords": [
+ "diff"
+ ],
+ "time": "2015-12-08T07:14:41+00:00"
+ },
+ {
+ "name": "sebastian/environment",
+ "version": "2.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/environment.git",
+ "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac",
+ "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.6 || ^7.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^5.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.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": "2016-11-26T07:53:53+00:00"
+ },
+ {
+ "name": "sebastian/exporter",
+ "version": "1.2.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/exporter.git",
+ "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4",
+ "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3",
+ "sebastian/recursion-context": "~1.0"
+ },
+ "require-dev": {
+ "ext-mbstring": "*",
+ "phpunit/phpunit": "~4.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.3.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": "2016-06-17T09:04:28+00:00"
+ },
+ {
+ "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-12T03:26:01+00:00"
+ },
+ {
+ "name": "sebastian/object-enumerator",
+ "version": "1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/object-enumerator.git",
+ "reference": "d4ca2fb70344987502567bc50081c03e6192fb26"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/d4ca2fb70344987502567bc50081c03e6192fb26",
+ "reference": "d4ca2fb70344987502567bc50081c03e6192fb26",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.6",
+ "sebastian/recursion-context": "~1.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~5"
+ },
+ "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": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Traverses array structures and object graphs to enumerate all referenced objects",
+ "homepage": "https://github.com/sebastianbergmann/object-enumerator/",
+ "time": "2016-01-28T13:25:10+00:00"
+ },
+ {
+ "name": "sebastian/recursion-context",
+ "version": "1.0.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/recursion-context.git",
+ "reference": "913401df809e99e4f47b27cdd781f4a258d58791"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791",
+ "reference": "913401df809e99e4f47b27cdd781f4a258d58791",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.4"
+ },
+ "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": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Adam Harvey",
+ "email": "aharvey@php.net"
+ }
+ ],
+ "description": "Provides functionality to recursively process PHP variables",
+ "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
+ "time": "2015-11-11T19:50:13+00:00"
+ },
+ {
+ "name": "sebastian/resource-operations",
+ "version": "1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/resource-operations.git",
+ "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52",
+ "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.6.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": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Provides a list of PHP built-in functions that operate on resources",
+ "homepage": "https://www.github.com/sebastianbergmann/resource-operations",
+ "time": "2015-07-28T20:34:47+00:00"
+ },
+ {
+ "name": "sebastian/version",
+ "version": "2.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/version.git",
+ "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019",
+ "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.6"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "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": "2016-10-03T07:35:21+00:00"
+ },
+ {
+ "name": "webmozart/assert",
+ "version": "1.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/webmozart/assert.git",
+ "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f",
+ "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^5.3.3 || ^7.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^4.6",
+ "sebastian/version": "^1.0.1"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.3-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Webmozart\\Assert\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@gmail.com"
+ }
+ ],
+ "description": "Assertions to validate method input/output with nice error messages.",
+ "keywords": [
+ "assert",
+ "check",
+ "validate"
+ ],
+ "time": "2016-11-23T20:04:58+00:00"
}
],
- "packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
new file mode 100644
index 0000000..92b426d
--- /dev/null
+++ b/phpunit.xml.dist
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ ./src/Mage/Tests/
+
+
+
+
+
+ benchmark
+ intl-data
+
+
+
+
+
+ ./src/Mage/
+
+ ./src/Mage/Tests/
+
+
+
+
\ No newline at end of file
diff --git a/src/Mage/Command/BuiltIn/DeployCommand.php b/src/Mage/Command/BuiltIn/DeployCommand.php
index 6392748..5a10e0f 100644
--- a/src/Mage/Command/BuiltIn/DeployCommand.php
+++ b/src/Mage/Command/BuiltIn/DeployCommand.php
@@ -72,7 +72,7 @@ class DeployCommand extends AbstractCommand
$this->log(sprintf('Environment: %s', $this->runtime->getEnvironment()));
if ($this->runtime->getEnvironmentConfig('releases', false)) {
- $this->runtime->setReleaseId(date('YmdHis'));
+ $this->runtime->generateReleaseId();
$output->writeln(sprintf(' Release ID: %s>', $this->runtime->getReleaseId()));
$this->log(sprintf('Release ID: %s', $this->runtime->getReleaseId()));
}
diff --git a/src/Mage/Command/BuiltIn/Releases/ListCommand.php b/src/Mage/Command/BuiltIn/Releases/ListCommand.php
index 86e0ef9..0c5b42c 100644
--- a/src/Mage/Command/BuiltIn/Releases/ListCommand.php
+++ b/src/Mage/Command/BuiltIn/Releases/ListCommand.php
@@ -87,7 +87,7 @@ class ListCommand extends AbstractCommand
$cmdListReleases = sprintf('ls -1 %s/releases', $hostPath);
/** @var Process $process */
- $process = $this->runtime->runRemoteCommand($cmdListReleases, true);
+ $process = $this->runtime->runRemoteCommand($cmdListReleases, false);
if (!$process->isSuccessful()) {
throw new RuntimeException(sprintf('Unable to retrieve releases from host %s', $host), 800);
}
@@ -102,7 +102,7 @@ class ListCommand extends AbstractCommand
$cmdCurrentRelease = sprintf('readlink -f %s/current', $hostPath);
/** @var Process $process */
- $process = $this->runtime->runRemoteCommand($cmdCurrentRelease, true);
+ $process = $this->runtime->runRemoteCommand($cmdCurrentRelease, false);
if (!$process->isSuccessful()) {
throw new RuntimeException(sprintf('Unable to retrieve current release from host %s', $host), 850);
}
diff --git a/src/Mage/Command/BuiltIn/Releases/RollbackCommand.php b/src/Mage/Command/BuiltIn/Releases/RollbackCommand.php
index 4afaedd..407c3bb 100644
--- a/src/Mage/Command/BuiltIn/Releases/RollbackCommand.php
+++ b/src/Mage/Command/BuiltIn/Releases/RollbackCommand.php
@@ -118,7 +118,7 @@ class RollbackCommand extends DeployCommand
$cmdListReleases = sprintf('ls -1 %s/releases', $hostPath);
/** @var Process $process */
- $process = $this->runtime->runRemoteCommand($cmdListReleases, true);
+ $process = $this->runtime->runRemoteCommand($cmdListReleases, false);
if (!$process->isSuccessful()) {
$releases = [];
} else {
diff --git a/src/Mage/Runtime/Runtime.php b/src/Mage/Runtime/Runtime.php
index b51af32..0f9f371 100644
--- a/src/Mage/Runtime/Runtime.php
+++ b/src/Mage/Runtime/Runtime.php
@@ -62,6 +62,17 @@ class Runtime implements RuntimeInterface
*/
protected $rollback = false;
+ /**
+ * Generate the Release ID
+ *
+ * @return RuntimeInterface
+ */
+ public function generateReleaseId()
+ {
+ $this->setReleaseId(date('YmdHis'));
+ return $this;
+ }
+
/**
* Sets the Release ID
*
@@ -409,4 +420,14 @@ class Runtime implements RuntimeInterface
return $sshConfig;
}
+
+ /**
+ * Gets a Temporal File name
+ *
+ * @return string
+ */
+ public function getTempFile()
+ {
+ return tempnam(sys_get_temp_dir(), 'mage');
+ }
}
diff --git a/src/Mage/Runtime/RuntimeInterface.php b/src/Mage/Runtime/RuntimeInterface.php
index 02ea63c..9814ad5 100644
--- a/src/Mage/Runtime/RuntimeInterface.php
+++ b/src/Mage/Runtime/RuntimeInterface.php
@@ -28,6 +28,13 @@ interface RuntimeInterface
const ON_RELEASE = 'on-release';
const POST_RELEASE = 'post-release';
+ /**
+ * Generate the Release ID
+ *
+ * @return RuntimeInterface
+ */
+ public function generateReleaseId();
+
/**
* Sets the Release ID
*
@@ -217,4 +224,11 @@ interface RuntimeInterface
* @return array
*/
public function getSSHConfig();
+
+ /**
+ * Gets a Temporal File name
+ *
+ * @return string
+ */
+ public function getTempFile();
}
diff --git a/src/Mage/Task/BuiltIn/Deploy/TarGz/PrepareTask.php b/src/Mage/Task/BuiltIn/Deploy/TarGz/PrepareTask.php
index 7644e3e..3375e2d 100644
--- a/src/Mage/Task/BuiltIn/Deploy/TarGz/PrepareTask.php
+++ b/src/Mage/Task/BuiltIn/Deploy/TarGz/PrepareTask.php
@@ -37,7 +37,7 @@ class PrepareTask extends AbstractTask
throw new DeploymentException('This task is only available with releases enabled', 400);
}
- $tarGzLocal = tempnam(sys_get_temp_dir(), 'mage');
+ $tarGzLocal = $this->runtime->getTempFile();
$this->runtime->setVar('targz_local', $tarGzLocal);
$excludes = $this->getExcludes();
diff --git a/src/Mage/Tests/Command/BuiltIn/DeployCommandTest.php b/src/Mage/Tests/Command/BuiltIn/DeployCommandTest.php
new file mode 100644
index 0000000..339e1d4
--- /dev/null
+++ b/src/Mage/Tests/Command/BuiltIn/DeployCommandTest.php
@@ -0,0 +1,233 @@
+add(new DeployCommand());
+
+ $runtime = new RuntimeMockup();
+ $runtime->setConfiguration(array (
+ 'environments' =>
+ array (
+ 'test' =>
+ array (
+ 'user' => 'tester',
+ 'branch' => 'test',
+ 'host_path' => '/var/www/test',
+ 'releases' => 4,
+ 'exclude' =>
+ array (
+ 0 => 'vendor',
+ 1 => 'app/cache',
+ 2 => 'app/log',
+ 3 => 'web/app_dev.php',
+ ),
+ 'hosts' =>
+ array (
+ 0 => 'testhost',
+ ),
+ 'pre-deploy' =>
+ array (
+ 0 => 'git/update',
+ 1 => 'composer/install',
+ 2 => 'composer/generate-autoload',
+ ),
+ 'on-deploy' =>
+ array (
+ 0 =>
+ array (
+ 'symfony/cache-clear' =>
+ array (
+ 'env' => 'dev',
+ ),
+ ),
+ 1 =>
+ array (
+ 'symfony/cache-warmup' =>
+ array (
+ 'env' => 'dev',
+ ),
+ ),
+ 2 =>
+ array (
+ 'symfony/assets-install' =>
+ array (
+ 'env' => 'dev',
+ ),
+ ),
+ 3 =>
+ array (
+ 'symfony/assetic-dump' =>
+ array (
+ 'env' => 'dev',
+ ),
+ ),
+ ),
+ 'on-release' => NULL,
+ 'post-release' => NULL,
+ 'post-deploy' => NULL,
+ ),
+ ),
+ )
+ );
+
+ $runtime->setReleaseId('20170101015120');
+
+ /** @var AbstractCommand $command */
+ $command = $application->find('deploy');
+ $command->setRuntime($runtime);
+
+ $tester = new CommandTester($command);
+ $tester->execute(['command' => $command->getName(), 'environment' => 'test']);
+
+ $ranCommands = $runtime->getRanCommands();
+
+ $testCase = array (
+ 0 => 'git branch | grep "*"',
+ 1 => 'git checkout test',
+ 2 => 'git pull',
+ 3 => 'composer install --dev',
+ 4 => 'composer dumpautoload --optimize',
+ 5 => 'tar cfz /tmp/mageXYZ --exclude=.git --exclude=vendor --exclude=app/cache --exclude=app/log --exclude=web/app_dev.php ./',
+ 6 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"mkdir -p /var/www/test/releases/1234567890\\"',
+ 7 => 'scp -P 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no /tmp/mageXYZ tester@testhost:/var/www/test/releases/1234567890/mageXYZ',
+ 8 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test/releases/1234567890 \\&\\& tar xfz mageXYZ\\"',
+ 9 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"rm /var/www/test/releases/1234567890/mageXYZ\\"',
+ 10 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test/releases/1234567890 \\&\\& bin/console cache:clear --env=dev \\"',
+ 11 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test/releases/1234567890 \\&\\& bin/console cache:warmup --env=dev \\"',
+ 12 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test/releases/1234567890 \\&\\& bin/console assets:install --env=dev --symlink --relative web\\"',
+ 13 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test/releases/1234567890 \\&\\& bin/console assetic:dump --env=dev \\"',
+ 14 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& ln -snf releases/1234567890 current\\"',
+ 15 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"ls -1 /var/www/test/releases\\"',
+ 16 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"rm -rf /var/www/test/releases/20170101015110\\"',
+ 17 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"rm -rf /var/www/test/releases/20170101015111\\"',
+ 18 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"rm -rf /var/www/test/releases/20170101015112\\"',
+ 19 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"rm -rf /var/www/test/releases/20170101015113\\"',
+ 20 => 'rm /tmp/mageXYZ',
+ 21 => 'git checkout master',
+ );
+
+ // Check total of Executed Commands
+ $this->assertEquals(count($ranCommands), count($testCase));
+
+ // Check Generated Commands
+ foreach ($testCase as $index => $command) {
+ $this->assertEquals($ranCommands[$index], $command);
+ }
+ }
+
+ public function testDeploymentWithoutReleasesCommands()
+ {
+ $application = new MageTestApplication();
+ $application->add(new DeployCommand());
+
+ $runtime = new RuntimeMockup();
+ $runtime->setConfiguration(array (
+ 'environments' =>
+ array (
+ 'test' =>
+ array (
+ 'user' => 'tester',
+ 'branch' => 'test',
+ 'host_path' => '/var/www/test',
+ 'exclude' =>
+ array (
+ 0 => 'vendor',
+ 1 => 'app/cache',
+ 2 => 'app/log',
+ 3 => 'web/app_dev.php',
+ ),
+ 'hosts' =>
+ array (
+ 0 => 'testhost',
+ ),
+ 'pre-deploy' =>
+ array (
+ 0 => 'git/update',
+ 1 => 'composer/install',
+ 2 => 'composer/generate-autoload',
+ ),
+ 'on-deploy' =>
+ array (
+ 0 =>
+ array (
+ 'symfony/cache-clear' =>
+ array (
+ 'env' => 'dev',
+ ),
+ ),
+ 1 =>
+ array (
+ 'symfony/cache-warmup' =>
+ array (
+ 'env' => 'dev',
+ ),
+ ),
+ 2 =>
+ array (
+ 'symfony/assets-install' =>
+ array (
+ 'env' => 'dev',
+ ),
+ ),
+ 3 =>
+ array (
+ 'symfony/assetic-dump' =>
+ array (
+ 'env' => 'dev',
+ ),
+ ),
+ ),
+ 'on-release' => NULL,
+ 'post-release' => NULL,
+ 'post-deploy' => NULL,
+ ),
+ ),
+ )
+ );
+
+ $runtime->setReleaseId('1234567890');
+
+ /** @var AbstractCommand $command */
+ $command = $application->find('deploy');
+ $command->setRuntime($runtime);
+
+ $tester = new CommandTester($command);
+ $tester->execute(['command' => $command->getName(), 'environment' => 'test']);
+
+ $ranCommands = $runtime->getRanCommands();
+
+ $testCase = array (
+ 0 => 'git branch | grep "*"',
+ 1 => 'git checkout test',
+ 2 => 'git pull',
+ 3 => 'composer install --dev',
+ 4 => 'composer dumpautoload --optimize',
+ 5 => 'rsync -avz --exclude=.git --exclude=vendor --exclude=app/cache --exclude=app/log --exclude=web/app_dev.php ./ tester@testhost:/var/www/test',
+ 6 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test/releases/1234567890 \\&\\& bin/console cache:clear --env=dev \\"',
+ 7 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test/releases/1234567890 \\&\\& bin/console cache:warmup --env=dev \\"',
+ 8 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test/releases/1234567890 \\&\\& bin/console assets:install --env=dev --symlink --relative web\\"',
+ 9 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test/releases/1234567890 \\&\\& bin/console assetic:dump --env=dev \\"',
+ 10 => 'git checkout master',
+ );
+
+ // Check total of Executed Commands
+ $this->assertEquals(count($ranCommands), count($testCase));
+
+ // Check Generated Commands
+ foreach ($testCase as $index => $command) {
+ $this->assertEquals($ranCommands[$index], $command);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Mage/Tests/Command/BuiltIn/Releases/ListCommandTest.php b/src/Mage/Tests/Command/BuiltIn/Releases/ListCommandTest.php
new file mode 100644
index 0000000..0226e8d
--- /dev/null
+++ b/src/Mage/Tests/Command/BuiltIn/Releases/ListCommandTest.php
@@ -0,0 +1,107 @@
+add(new ListCommand());
+
+ $runtime = new RuntimeMockup();
+ $runtime->setConfiguration(array (
+ 'environments' =>
+ array (
+ 'test' =>
+ array (
+ 'user' => 'tester',
+ 'branch' => 'test',
+ 'host_path' => '/var/www/test',
+ 'releases' => 4,
+ 'exclude' =>
+ array (
+ 0 => 'vendor',
+ 1 => 'app/cache',
+ 2 => 'app/log',
+ 3 => 'web/app_dev.php',
+ ),
+ 'hosts' =>
+ array (
+ 0 => 'testhost',
+ ),
+ 'pre-deploy' =>
+ array (
+ 0 => 'git/update',
+ 1 => 'composer/install',
+ 2 => 'composer/generate-autoload',
+ ),
+ 'on-deploy' =>
+ array (
+ 0 =>
+ array (
+ 'symfony/cache-clear' =>
+ array (
+ 'env' => 'dev',
+ ),
+ ),
+ 1 =>
+ array (
+ 'symfony/cache-warmup' =>
+ array (
+ 'env' => 'dev',
+ ),
+ ),
+ 2 =>
+ array (
+ 'symfony/assets-install' =>
+ array (
+ 'env' => 'dev',
+ ),
+ ),
+ 3 =>
+ array (
+ 'symfony/assetic-dump' =>
+ array (
+ 'env' => 'dev',
+ ),
+ ),
+ ),
+ 'on-release' => NULL,
+ 'post-release' => NULL,
+ 'post-deploy' => NULL,
+ ),
+ ),
+ )
+ );
+
+ /** @var AbstractCommand $command */
+ $command = $application->find('releases:list');
+ $command->setRuntime($runtime);
+
+ $tester = new CommandTester($command);
+ $tester->execute(['command' => $command->getName(), 'environment' => 'test']);
+
+ $ranCommands = $runtime->getRanCommands();
+
+ $testCase = array (
+ 0 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"ls -1 /var/www/test/releases\\"',
+ 1 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"readlink -f /var/www/test/current\\"',
+ );
+
+ // Check total of Executed Commands
+ $this->assertEquals(count($ranCommands), count($testCase));
+
+ // Check Generated Commands
+ foreach ($testCase as $index => $command) {
+ $this->assertEquals($ranCommands[$index], $command);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/Mage/Tests/Command/BuiltIn/Releases/RollbackCommandTest.php b/src/Mage/Tests/Command/BuiltIn/Releases/RollbackCommandTest.php
new file mode 100644
index 0000000..8f4e4cc
--- /dev/null
+++ b/src/Mage/Tests/Command/BuiltIn/Releases/RollbackCommandTest.php
@@ -0,0 +1,107 @@
+add(new RollbackCommand());
+
+ $runtime = new RuntimeMockup();
+ $runtime->setConfiguration(array (
+ 'environments' =>
+ array (
+ 'test' =>
+ array (
+ 'user' => 'tester',
+ 'branch' => 'test',
+ 'host_path' => '/var/www/test',
+ 'releases' => 4,
+ 'exclude' =>
+ array (
+ 0 => 'vendor',
+ 1 => 'app/cache',
+ 2 => 'app/log',
+ 3 => 'web/app_dev.php',
+ ),
+ 'hosts' =>
+ array (
+ 0 => 'testhost',
+ ),
+ 'pre-deploy' =>
+ array (
+ 0 => 'git/update',
+ 1 => 'composer/install',
+ 2 => 'composer/generate-autoload',
+ ),
+ 'on-deploy' =>
+ array (
+ 0 =>
+ array (
+ 'symfony/cache-clear' =>
+ array (
+ 'env' => 'dev',
+ ),
+ ),
+ 1 =>
+ array (
+ 'symfony/cache-warmup' =>
+ array (
+ 'env' => 'dev',
+ ),
+ ),
+ 2 =>
+ array (
+ 'symfony/assets-install' =>
+ array (
+ 'env' => 'dev',
+ ),
+ ),
+ 3 =>
+ array (
+ 'symfony/assetic-dump' =>
+ array (
+ 'env' => 'dev',
+ ),
+ ),
+ ),
+ 'on-release' => NULL,
+ 'post-release' => NULL,
+ 'post-deploy' => NULL,
+ ),
+ ),
+ )
+ );
+
+ /** @var AbstractCommand $command */
+ $command = $application->find('releases:rollback');
+ $command->setRuntime($runtime);
+
+ $tester = new CommandTester($command);
+ $tester->execute(['command' => $command->getName(), 'environment' => 'test', 'release' => '20170101015115']);
+
+ $ranCommands = $runtime->getRanCommands();
+
+ $testCase = array (
+ 0 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"ls -1 /var/www/test/releases\\"',
+ 1 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& ln -snf releases/20170101015115 current\\"',
+ );
+
+ // Check total of Executed Commands
+ $this->assertEquals(count($ranCommands), count($testCase));
+
+ // Check Generated Commands
+ foreach ($testCase as $index => $command) {
+ $this->assertEquals($ranCommands[$index], $command);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/Mage/Tests/Command/BuiltIn/VersionCommandTest.php b/src/Mage/Tests/Command/BuiltIn/VersionCommandTest.php
new file mode 100644
index 0000000..12638a5
--- /dev/null
+++ b/src/Mage/Tests/Command/BuiltIn/VersionCommandTest.php
@@ -0,0 +1,30 @@
+add(new VersionCommand());
+
+ /** @var AbstractCommand $command */
+ $command = $application->find('version');
+ $command->setRuntime(new RuntimeMockup());
+
+ $tester = new CommandTester($command);
+ $tester->execute(['command' => $command->getName()]);
+
+ $output = trim($tester->getDisplay());
+ $this->assertEquals(sprintf('Magallanes v%s [%s]', Mage::VERSION, Mage::CODENAME), $output);
+ }
+}
\ No newline at end of file
diff --git a/src/Mage/Tests/MageTestApplication.php b/src/Mage/Tests/MageTestApplication.php
new file mode 100644
index 0000000..0aa5859
--- /dev/null
+++ b/src/Mage/Tests/MageTestApplication.php
@@ -0,0 +1,32 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Mage\Tests;
+
+use Mage\Command\AbstractCommand;
+use Mage\Runtime\Runtime;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Finder\Finder;
+use Symfony\Component\Finder\SplFileInfo;
+use Monolog\Logger;
+use Monolog\Handler\StreamHandler;
+use Symfony\Component\Console\Application;
+use Symfony\Component\Yaml\Yaml;
+use Mage\Runtime\Exception\RuntimeException;
+
+/**
+ * The Console Application for launching the Mage command in a standalone instance
+ *
+ * @author Andrés Montañez
+ */
+class MageTestApplication extends Application
+{
+}
diff --git a/src/Mage/Tests/Runtime/ProcessMockup.php b/src/Mage/Tests/Runtime/ProcessMockup.php
new file mode 100644
index 0000000..a470107
--- /dev/null
+++ b/src/Mage/Tests/Runtime/ProcessMockup.php
@@ -0,0 +1,52 @@
+commandline = $commandline;
+ }
+
+ public function setTimeout($timeout)
+ {
+ $this->timeout = $timeout;
+ }
+
+ public function run($callback = null)
+ {
+
+ }
+
+ public function isSuccessful()
+ {
+ return true;
+ }
+
+ public function getErrorOutput()
+ {
+ return '';
+ }
+
+ public function getOutput()
+ {
+ if ($this->commandline == 'git branch | grep "*"') {
+ return '* master';
+ }
+
+ if ($this->commandline == 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \"ls -1 /var/www/test/releases\"') {
+ return implode(PHP_EOL, ['20170101015110', '20170101015111', '20170101015112', '20170101015113', '20170101015114', '20170101015115', '20170101015116', '20170101015117']);
+ }
+
+ if ($this->commandline == 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \"readlink -f /var/www/test/current\"') {
+ return '/var/www/test/releases/20170101015120';
+ }
+
+ return '';
+ }
+}
\ No newline at end of file
diff --git a/src/Mage/Tests/Runtime/RuntimeMockup.php b/src/Mage/Tests/Runtime/RuntimeMockup.php
new file mode 100644
index 0000000..aa82305
--- /dev/null
+++ b/src/Mage/Tests/Runtime/RuntimeMockup.php
@@ -0,0 +1,55 @@
+ranCommands;
+ }
+
+ /**
+ * Generate the Release ID
+ *
+ * @return RuntimeInterface
+ */
+ public function generateReleaseId()
+ {
+ $this->setReleaseId('1234567890');
+ return $this;
+ }
+
+ /**
+ * Execute a command locally
+ *
+ * @param string $cmd Command to execute
+ * @param int $timeout Seconds to wait
+ * @return Process
+ */
+ public function runLocalCommand($cmd, $timeout = 120)
+ {
+ $this->ranCommands[] = $cmd;
+
+ $process = new ProcessMockup($cmd);
+ $process->setTimeout($timeout);
+ $process->run();
+
+ return $process;
+ }
+
+ /**
+ * Gets a Temporal File name
+ *
+ * @return string
+ */
+ public function getTempFile()
+ {
+ return '/tmp/mageXYZ';
+ }
+}
\ No newline at end of file