mirror of
https://github.com/andres-montanez/Magallanes
synced 2024-06-19 22:15:05 +02:00
commit
e0429f0223
2
.coveralls.yml
Normal file
2
.coveralls.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
src_dir: Mage
|
||||
coverage_clover: build/logs/coverage.xml
|
10
.travis.yml
10
.travis.yml
|
@ -7,4 +7,12 @@ php:
|
|||
- 5.6
|
||||
|
||||
install:
|
||||
- composer install --dev --prefer-source
|
||||
- composer self-update
|
||||
- composer install --prefer-source
|
||||
|
||||
script:
|
||||
- mkdir -p build/logs
|
||||
- bin/phpunit --coverage-clover build/logs/coverage.xml
|
||||
|
||||
after_script:
|
||||
- bin/coveralls -v
|
||||
|
|
|
@ -43,14 +43,17 @@ class Factory
|
|||
// try a custom command
|
||||
$className = 'Command\\' . $commandName;
|
||||
|
||||
// TODO use a custom exception
|
||||
if (!class_exists($className)) {
|
||||
throw new Exception('Command "' . $commandName . '" not found.');
|
||||
}
|
||||
}
|
||||
|
||||
/** @var AbstractCommand $instance */
|
||||
// TODO dependencies like $config should be injected into constructor
|
||||
$instance = new $className;
|
||||
if (! $instance instanceOf AbstractCommand) {
|
||||
// TODO use a custom exception
|
||||
throw new Exception('The command ' . $commandName . ' must be an instance of Mage\Command\AbstractCommand.');
|
||||
}
|
||||
|
||||
|
|
|
@ -74,12 +74,13 @@ class ReleaseTask extends AbstractTask implements IsReleaseAware, SkipOnOverride
|
|||
}
|
||||
}
|
||||
|
||||
if ($resultFetch && $userGroup != '') {
|
||||
$command = 'chown -h ' . $userGroup . ' ' . $symlink
|
||||
. ' && '
|
||||
. 'chown -R ' . $userGroup . ' ' . $currentCopy
|
||||
if ($resultFetch && $userGroup != '') {
|
||||
$command = 'chown -R ' . $userGroup . ' ' . $currentCopy
|
||||
. ' && '
|
||||
. 'chown ' . $userGroup . ' ' . $releasesDirectory;
|
||||
if (file_exists($symlink)) {
|
||||
$command.= ' && ' . 'chown -h ' . $userGroup . ' ' . $symlink;
|
||||
}
|
||||
$result = $this->runCommandRemote($command);
|
||||
if (!$result) {
|
||||
return $result;
|
||||
|
|
|
@ -34,6 +34,17 @@ class GitRebaseTask extends BaseStrategyTaskAbstract implements IsReleaseAware
|
|||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->checkOverrideRelease();
|
||||
|
||||
if ($this->getConfig()->release('enabled', false) == true) {
|
||||
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
|
||||
|
||||
$deployToDirectory = rtrim($this->getConfig()->deployment('to'), '/')
|
||||
. '/' . $releasesDirectory
|
||||
. '/' . $this->getConfig()->getReleaseId();
|
||||
$this->runCommandRemote('mkdir -p ' . $deployToDirectory);
|
||||
}
|
||||
|
||||
$branch = $this->getParameter('branch', 'master');
|
||||
$remote = $this->getParameter('remote', 'origin');
|
||||
|
||||
|
|
|
@ -73,11 +73,13 @@ class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
|
|||
// rsync: { copy: yes }
|
||||
$rsync_copy = $this->getConfig()->deployment('rsync');
|
||||
// If copy_tool_rsync, use rsync rather than cp for finer control of what is copied
|
||||
if ($rsync_copy && is_array($rsync_copy) && $rsync_copy['copy'] && isset($rsync_copy['copy_tool_rsync'])) {
|
||||
$this->runCommandRemote("rsync -a {$this->excludes(array_merge($excludes, $rsync_copy['rsync_excludes']))} "
|
||||
if ($rsync_copy && is_array($rsync_copy) && $rsync_copy['copy'] && is_dir("$releasesDirectory/$currentRelease")) {
|
||||
if (isset($rsync_copy['copy_tool_rsync'])) {
|
||||
$this->runCommandRemote("rsync -a {$this->excludes(array_merge($excludes, $rsync_copy['rsync_excludes']))} "
|
||||
. "$releasesDirectory/$currentRelease/ $releasesDirectory/{$this->getConfig()->getReleaseId()}");
|
||||
} elseif ($rsync_copy && is_array($rsync_copy) && $rsync_copy['copy']) {
|
||||
$this->runCommandRemote('cp -R ' . $releasesDirectory . '/' . $currentRelease . ' ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
|
||||
} else {
|
||||
$this->runCommandRemote('cp -R ' . $releasesDirectory . '/' . $currentRelease . ' ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
|
||||
}
|
||||
} else {
|
||||
$this->runCommandRemote('mkdir -p ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
|
||||
}
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
"php": ">=5.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.3.5"
|
||||
"phpunit/phpunit": "4.3.5",
|
||||
"satooshi/php-coveralls": ">=0.6.1"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
|
457
composer.lock
generated
457
composer.lock
generated
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"hash": "7a55b88add493fbc9910519e7e9c3a3b",
|
||||
"hash": "d82ccc62c52f99a0819bea9b247d4f86",
|
||||
"packages": [],
|
||||
"packages-dev": [
|
||||
{
|
||||
|
@ -61,6 +61,98 @@
|
|||
],
|
||||
"time": "2014-10-13 12:58:55"
|
||||
},
|
||||
{
|
||||
"name": "guzzle/guzzle",
|
||||
"version": "v3.9.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/guzzle3.git",
|
||||
"reference": "54991459675c1a2924122afbb0e5609ade581155"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle3/zipball/54991459675c1a2924122afbb0e5609ade581155",
|
||||
"reference": "54991459675c1a2924122afbb0e5609ade581155",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-curl": "*",
|
||||
"php": ">=5.3.3",
|
||||
"symfony/event-dispatcher": "~2.1"
|
||||
},
|
||||
"replace": {
|
||||
"guzzle/batch": "self.version",
|
||||
"guzzle/cache": "self.version",
|
||||
"guzzle/common": "self.version",
|
||||
"guzzle/http": "self.version",
|
||||
"guzzle/inflection": "self.version",
|
||||
"guzzle/iterator": "self.version",
|
||||
"guzzle/log": "self.version",
|
||||
"guzzle/parser": "self.version",
|
||||
"guzzle/plugin": "self.version",
|
||||
"guzzle/plugin-async": "self.version",
|
||||
"guzzle/plugin-backoff": "self.version",
|
||||
"guzzle/plugin-cache": "self.version",
|
||||
"guzzle/plugin-cookie": "self.version",
|
||||
"guzzle/plugin-curlauth": "self.version",
|
||||
"guzzle/plugin-error-response": "self.version",
|
||||
"guzzle/plugin-history": "self.version",
|
||||
"guzzle/plugin-log": "self.version",
|
||||
"guzzle/plugin-md5": "self.version",
|
||||
"guzzle/plugin-mock": "self.version",
|
||||
"guzzle/plugin-oauth": "self.version",
|
||||
"guzzle/service": "self.version",
|
||||
"guzzle/stream": "self.version"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/cache": "~1.3",
|
||||
"monolog/monolog": "~1.0",
|
||||
"phpunit/phpunit": "3.7.*",
|
||||
"psr/log": "~1.0",
|
||||
"symfony/class-loader": "~2.1",
|
||||
"zendframework/zend-cache": "2.*,<2.3",
|
||||
"zendframework/zend-log": "2.*,<2.3"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.9-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Guzzle": "src/",
|
||||
"Guzzle\\Tests": "tests/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michael Dowling",
|
||||
"email": "mtdowling@gmail.com",
|
||||
"homepage": "https://github.com/mtdowling"
|
||||
},
|
||||
{
|
||||
"name": "Guzzle Community",
|
||||
"homepage": "https://github.com/guzzle/guzzle/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
|
||||
"homepage": "http://guzzlephp.org/",
|
||||
"keywords": [
|
||||
"client",
|
||||
"curl",
|
||||
"framework",
|
||||
"http",
|
||||
"http client",
|
||||
"rest",
|
||||
"web service"
|
||||
],
|
||||
"time": "2014-08-11 04:32:36"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
"version": "2.0.13",
|
||||
|
@ -437,6 +529,112 @@
|
|||
],
|
||||
"time": "2014-10-03 05:12:11"
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
"version": "1.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/log.git",
|
||||
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
|
||||
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
|
||||
"shasum": ""
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Psr\\Log\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for logging libraries",
|
||||
"keywords": [
|
||||
"log",
|
||||
"psr",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2012-12-21 11:40:51"
|
||||
},
|
||||
{
|
||||
"name": "satooshi/php-coveralls",
|
||||
"version": "v0.6.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/satooshi/php-coveralls.git",
|
||||
"reference": "dd0df95bd37a7cf5c5c50304dfe260ffe4b50760"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/satooshi/php-coveralls/zipball/dd0df95bd37a7cf5c5c50304dfe260ffe4b50760",
|
||||
"reference": "dd0df95bd37a7cf5c5c50304dfe260ffe4b50760",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-simplexml": "*",
|
||||
"guzzle/guzzle": ">=3.0",
|
||||
"php": ">=5.3",
|
||||
"psr/log": "1.0.0",
|
||||
"symfony/config": ">=2.0",
|
||||
"symfony/console": ">=2.0",
|
||||
"symfony/stopwatch": ">=2.2",
|
||||
"symfony/yaml": ">=2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"apigen/apigen": "2.8.*@stable",
|
||||
"pdepend/pdepend": "dev-master",
|
||||
"phpmd/phpmd": "dev-master",
|
||||
"phpunit/php-invoker": ">=1.1.0,<1.2.0",
|
||||
"phpunit/phpunit": "3.7.*@stable",
|
||||
"sebastian/finder-facade": "dev-master",
|
||||
"sebastian/phpcpd": "1.4.*@stable",
|
||||
"squizlabs/php_codesniffer": "1.4.*@stable",
|
||||
"theseer/fdomdocument": "dev-master"
|
||||
},
|
||||
"bin": [
|
||||
"composer/bin/coveralls"
|
||||
],
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Contrib\\Component": "src/",
|
||||
"Contrib\\Bundle": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kitamura Satoshi",
|
||||
"email": "with.no.parachute@gmail.com",
|
||||
"homepage": "https://www.facebook.com/satooshi.jp"
|
||||
}
|
||||
],
|
||||
"description": "PHP client library for Coveralls API",
|
||||
"homepage": "https://github.com/satooshi/php-coveralls",
|
||||
"keywords": [
|
||||
"ci",
|
||||
"coverage",
|
||||
"github",
|
||||
"test"
|
||||
],
|
||||
"time": "2013-05-04 08:07:33"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/comparator",
|
||||
"version": "1.1.0",
|
||||
|
@ -703,6 +901,263 @@
|
|||
"homepage": "https://github.com/sebastianbergmann/version",
|
||||
"time": "2014-03-07 15:35:33"
|
||||
},
|
||||
{
|
||||
"name": "symfony/config",
|
||||
"version": "v2.6.4",
|
||||
"target-dir": "Symfony/Component/Config",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/Config.git",
|
||||
"reference": "a9f781ba1221067d1f07c8cec0bc50f81b8d7408"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/Config/zipball/a9f781ba1221067d1f07c8cec0bc50f81b8d7408",
|
||||
"reference": "a9f781ba1221067d1f07c8cec0bc50f81b8d7408",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"symfony/filesystem": "~2.3"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.6-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\Config\\": ""
|
||||
}
|
||||
},
|
||||
"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 Config Component",
|
||||
"homepage": "http://symfony.com",
|
||||
"time": "2015-01-21 20:57:55"
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v2.6.4",
|
||||
"target-dir": "Symfony/Component/Console",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/Console.git",
|
||||
"reference": "e44154bfe3e41e8267d7a3794cd9da9a51cfac34"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/Console/zipball/e44154bfe3e41e8267d7a3794cd9da9a51cfac34",
|
||||
"reference": "e44154bfe3e41e8267d7a3794cd9da9a51cfac34",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/log": "~1.0",
|
||||
"symfony/event-dispatcher": "~2.1",
|
||||
"symfony/process": "~2.1"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/log": "For using the console logger",
|
||||
"symfony/event-dispatcher": "",
|
||||
"symfony/process": ""
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.6-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\Console\\": ""
|
||||
}
|
||||
},
|
||||
"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 Console Component",
|
||||
"homepage": "http://symfony.com",
|
||||
"time": "2015-01-25 04:39:26"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
"version": "v2.6.4",
|
||||
"target-dir": "Symfony/Component/EventDispatcher",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/EventDispatcher.git",
|
||||
"reference": "f75989f3ab2743a82fe0b03ded2598a2b1546813"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/f75989f3ab2743a82fe0b03ded2598a2b1546813",
|
||||
"reference": "f75989f3ab2743a82fe0b03ded2598a2b1546813",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/log": "~1.0",
|
||||
"symfony/config": "~2.0,>=2.0.5",
|
||||
"symfony/dependency-injection": "~2.6",
|
||||
"symfony/expression-language": "~2.6",
|
||||
"symfony/stopwatch": "~2.3"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/dependency-injection": "",
|
||||
"symfony/http-kernel": ""
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.6-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\EventDispatcher\\": ""
|
||||
}
|
||||
},
|
||||
"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 EventDispatcher Component",
|
||||
"homepage": "http://symfony.com",
|
||||
"time": "2015-02-01 16:10:57"
|
||||
},
|
||||
{
|
||||
"name": "symfony/filesystem",
|
||||
"version": "v2.6.4",
|
||||
"target-dir": "Symfony/Component/Filesystem",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/Filesystem.git",
|
||||
"reference": "a1f566d1f92e142fa1593f4555d6d89e3044a9b7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/Filesystem/zipball/a1f566d1f92e142fa1593f4555d6d89e3044a9b7",
|
||||
"reference": "a1f566d1f92e142fa1593f4555d6d89e3044a9b7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.6-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\Filesystem\\": ""
|
||||
}
|
||||
},
|
||||
"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 Filesystem Component",
|
||||
"homepage": "http://symfony.com",
|
||||
"time": "2015-01-03 21:13:09"
|
||||
},
|
||||
{
|
||||
"name": "symfony/stopwatch",
|
||||
"version": "v2.6.4",
|
||||
"target-dir": "Symfony/Component/Stopwatch",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/Stopwatch.git",
|
||||
"reference": "e8da5286132ba75ce4b4275fbf0f4cd369bfd71c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/Stopwatch/zipball/e8da5286132ba75ce4b4275fbf0f4cd369bfd71c",
|
||||
"reference": "e8da5286132ba75ce4b4275fbf0f4cd369bfd71c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.6-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Symfony\\Component\\Stopwatch\\": ""
|
||||
}
|
||||
},
|
||||
"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 Stopwatch Component",
|
||||
"homepage": "http://symfony.com",
|
||||
"time": "2015-01-03 08:01:59"
|
||||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
"version": "v2.6.1",
|
||||
|
|
63
tests/MageTest/Command/FactoryTest.php
Normal file
63
tests/MageTest/Command/FactoryTest.php
Normal file
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
namespace MageTest\Command;
|
||||
|
||||
use Mage\Command\Factory;
|
||||
use PHPUnit_Framework_TestCase;
|
||||
|
||||
/**
|
||||
* @group Mage_Command
|
||||
* @group Mage_Command_Factory
|
||||
*
|
||||
* @group issue-167
|
||||
*/
|
||||
class FactoryTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $config;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->config = $this->getMock('Mage\Config');
|
||||
}
|
||||
|
||||
public function testGet()
|
||||
{
|
||||
$command = Factory::get('add', $this->config);
|
||||
$this->assertInstanceOf('Mage\\Command\\BuiltIn\\AddCommand', $command);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testGetClassNotFoundException()
|
||||
{
|
||||
$command = Factory::get('commanddoesntexist', $this->config);
|
||||
}
|
||||
|
||||
public function testGetCustomCommand()
|
||||
{
|
||||
$this->getMockBuilder('Mage\\Command\\AbstractCommand')
|
||||
->setMockClassName('MyCommand')
|
||||
->getMock();
|
||||
|
||||
/**
|
||||
* current workaround
|
||||
* @link https://github.com/sebastianbergmann/phpunit-mock-objects/issues/134
|
||||
*/
|
||||
class_alias('MyCommand', 'Command\\MyCommand');
|
||||
|
||||
$command = Factory::get('my-command', $this->config);
|
||||
$this->assertInstanceOf('Command\\MyCommand', $command);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
* @expectedExceptionMessage The command MyInconsistentCommand must be an instance of Mage\Command\AbstractCommand.
|
||||
*/
|
||||
public function testGetInconsistencyException()
|
||||
{
|
||||
$this->getMock('Command\\MyInconsistentCommand');
|
||||
|
||||
$command = Factory::get('my-inconsistent-command', $this->config);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue