[Discovery One] Upgrade to Symfony 4 and PHPUnit 7

This commit is contained in:
Andrés Montañez 2018-03-29 20:19:35 -03:00
parent 23dae99c1a
commit 05d9cf0b80
30 changed files with 51 additions and 47 deletions

View file

@ -1,8 +1,5 @@
language: php
php:
- '5.5'
- '5.6'
- '7.0'
- '7.1'
- '7.2'

View file

@ -1,7 +1,7 @@
{
"name": "andres-montanez/magallanes",
"description": "The Deployment Tool for PHP Applications",
"homepage": "http://magephp.com",
"homepage": "https://magephp.com",
"license": "MIT",
"type": "library",
"keywords": ["deployment"],
@ -12,17 +12,17 @@
}
],
"require": {
"php": ">=5.5.9",
"monolog/monolog": "^1.0",
"symfony/console": "^3.0",
"symfony/filesystem": "^3.0",
"symfony/event-dispatcher": "^3.0",
"symfony/finder": "^3.0",
"symfony/yaml": "^3.0",
"symfony/process": "^3.0"
"php": "^7.1.3",
"monolog/monolog": "~1.11",
"symfony/console": "^4.0",
"symfony/filesystem": "^4.0",
"symfony/event-dispatcher": "^4.0",
"symfony/finder": "^4.0",
"symfony/yaml": "^4.0",
"symfony/process": "^4.0"
},
"require-dev": {
"phpunit/phpunit": "4.8.*",
"phpunit/phpunit": "^7.0",
"satooshi/php-coveralls": "~1.0"
},
"autoload": {
@ -38,8 +38,8 @@
"bin": ["bin/mage"],
"extra": {
"branch-alias": {
"dev-master": "3.0.x-dev",
"dev-nostromo": "3.x-dev"
"dev-master": "4.0.x-dev",
"dev-discovery-one": "4.x-dev"
}
}
}

View file

@ -2,7 +2,7 @@ FROM ubuntu:17.10
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y vim curl git unzip
RUN apt-get install -y php7.1-cli php-zip php7.1-curl php7.1-xml
RUN apt-get install -y php7.1-cli php-zip php7.1-curl php7.1-xml php7.1-mbstring
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer

View file

@ -17,6 +17,6 @@ namespace Mage;
*/
class Mage
{
const VERSION = '3.4.0';
const CODENAME = 'Nostromo';
const VERSION = '4.x';
const CODENAME = 'Discovery One';
}

View file

@ -17,7 +17,7 @@ use Symfony\Component\Finder\SplFileInfo;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Console\Event\ConsoleExceptionEvent;
use Symfony\Component\Console\Event\ConsoleErrorEvent;
use Symfony\Component\Console\ConsoleEvents;
use Symfony\Component\Console\Application;
use Symfony\Component\Yaml\Parser;
@ -46,12 +46,12 @@ class MageApplication extends Application
$dispatcher = new EventDispatcher();
$this->setDispatcher($dispatcher);
$dispatcher->addListener(ConsoleEvents::EXCEPTION, function (ConsoleExceptionEvent $event) {
$dispatcher->addListener(ConsoleEvents::ERROR, function (ConsoleErrorEvent $event) {
$output = $event->getOutput();
$command = $event->getCommand();
$output->writeln(sprintf('Oops, exception thrown while running command <info>%s</info>', $command->getName()));
$exitCode = $event->getExitCode();
$event->setException(new \LogicException('Caught exception', $exitCode, $event->getException()));
$event->setError(new \LogicException('Caught exception', $exitCode, $event->getError()));
});
$this->runtime = $this->instantiateRuntime();

View file

@ -14,7 +14,7 @@ use Mage\Command\BuiltIn\Config\DumpCommand;
use Mage\Command\AbstractCommand;
use Mage\Tests\MageApplicationMockup;
use Symfony\Component\Console\Tester\CommandTester;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
class DumpCommandTest extends TestCase
{

View file

@ -14,7 +14,7 @@ use Mage\Command\BuiltIn\Config\EnvironmentsCommand;
use Mage\Command\AbstractCommand;
use Mage\Tests\MageApplicationMockup;
use Symfony\Component\Console\Tester\CommandTester;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
class EnvironmentsCommandTest extends TestCase
{

View file

@ -14,7 +14,7 @@ use Mage\Command\BuiltIn\DeployCommand;
use Mage\Tests\MageApplicationMockup;
use Mage\Command\AbstractCommand;
use Symfony\Component\Console\Tester\CommandTester;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
class DeployCommandMiscTasksTest extends TestCase
{

View file

@ -15,7 +15,7 @@ use Mage\Runtime\Exception\RuntimeException;
use Mage\Tests\MageApplicationMockup;
use Mage\Command\AbstractCommand;
use Symfony\Component\Console\Tester\CommandTester;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
class DeployCommandMiscTest extends TestCase
{

View file

@ -14,7 +14,7 @@ use Mage\Command\BuiltIn\DeployCommand;
use Mage\Command\AbstractCommand;
use Mage\Tests\MageApplicationMockup;
use Symfony\Component\Console\Tester\CommandTester;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
class DeployCommandWithReleasesTest extends TestCase
{

View file

@ -14,7 +14,7 @@ use Mage\Command\BuiltIn\DeployCommand;
use Mage\Command\AbstractCommand;
use Mage\Tests\MageApplicationMockup;
use Symfony\Component\Console\Tester\CommandTester;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
class DeployCommandWithoutReleasesTest extends TestCase
{

View file

@ -14,7 +14,7 @@ use Mage\Command\BuiltIn\Releases\ListCommand;
use Mage\Command\AbstractCommand;
use Mage\Tests\MageApplicationMockup;
use Symfony\Component\Console\Tester\CommandTester;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
class ListCommandTest extends TestCase
{

View file

@ -14,7 +14,7 @@ use Mage\Command\BuiltIn\Releases\RollbackCommand;
use Mage\Command\AbstractCommand;
use Mage\Tests\MageApplicationMockup;
use Symfony\Component\Console\Tester\CommandTester;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
class RollbackCommandTest extends TestCase
{

View file

@ -15,7 +15,7 @@ use Mage\Command\BuiltIn\VersionCommand;
use Mage\Tests\MageApplicationMockup;
use Mage\Mage;
use Symfony\Component\Console\Tester\CommandTester;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
class VersionCommandTest extends TestCase
{

View file

@ -15,7 +15,7 @@ use Mage\Deploy\Strategy\RsyncStrategy;
use Mage\Runtime\Exception\RuntimeException;
use Mage\Runtime\Runtime;
use Exception;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
class StrategyTest extends TestCase
{

View file

@ -14,7 +14,7 @@ use Mage\MageApplication;
use Mage\Runtime\Exception\RuntimeException;
use Symfony\Component\Console\Tester\ApplicationTester;
use Exception;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
class MageApplicationTest extends TestCase
{

View file

@ -19,7 +19,7 @@ class ProcessMockup extends Process
protected $timeout;
protected $success = true;
public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
public function __construct($commandline, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
{
$this->commandline = $commandline;
}
@ -29,7 +29,7 @@ class ProcessMockup extends Process
$this->timeout = $timeout;
}
public function run($callback = null)
public function run(callable $callback = null, array $env = array()): int
{
if (in_array($this->commandline, $this->forceFail)) {
$this->success = false;
@ -50,6 +50,12 @@ class ProcessMockup extends Process
if ($this->commandline == 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@hostdemo2 "ls -1 /var/www/test/releases"') {
$this->success = false;
}
if (!$this->success) {
return 10;
}
return 0;
}
public function isSuccessful()

View file

@ -15,7 +15,7 @@ use Mage\Runtime\Runtime;
use Exception;
use Monolog\Logger;
use Monolog\Handler\TestHandler;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
use Psr\Log\LogLevel;
use Symfony\Component\Process\Process;
use DateTime;

View file

@ -12,7 +12,7 @@ namespace Mage\Tests\Task;
use Mage\Task\Exception\ErrorException;
use Exception;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
class AbstractTaskTest extends TestCase
{

View file

@ -3,7 +3,7 @@
namespace Mage\Tests\Task\BuiltIn\Composer;
use Mage\Tests\Runtime\RuntimeMockup;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
class BasicComposerTaskTest extends TestCase
{

View file

@ -6,7 +6,7 @@ use Mage\Tests\Runtime\RuntimeMockup;
use Mage\Task\BuiltIn\Composer\SelfUpdateTask;
use Mage\Task\Exception\SkipException;
use Exception;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
class SelfUpdateTaskTest extends TestCase
{

View file

@ -14,7 +14,7 @@ use Mage\Task\Exception\ErrorException;
use Mage\Task\BuiltIn\ExecTask;
use Exception;
use Mage\Tests\Runtime\RuntimeMockup;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
class ExecTest extends TestCase
{

View file

@ -14,7 +14,7 @@ use Mage\Task\Exception\ErrorException;
use Mage\Task\BuiltIn\FS\ChangeModeTask;
use Exception;
use Mage\Tests\Runtime\RuntimeMockup;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
class ChangeModeTest extends TestCase
{

View file

@ -14,7 +14,7 @@ use Mage\Task\Exception\ErrorException;
use Mage\Task\BuiltIn\FS\CopyTask;
use Exception;
use Mage\Tests\Runtime\RuntimeMockup;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
class CopyTaskTest extends TestCase
{

View file

@ -14,7 +14,7 @@ use Mage\Task\Exception\ErrorException;
use Mage\Task\BuiltIn\FS\LinkTask;
use Exception;
use Mage\Tests\Runtime\RuntimeMockup;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
class LinkTaskTest extends TestCase
{

View file

@ -14,7 +14,7 @@ use Mage\Task\Exception\ErrorException;
use Mage\Task\BuiltIn\FS\MoveTask;
use Exception;
use Mage\Tests\Runtime\RuntimeMockup;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
class MoveTaskTest extends TestCase
{

View file

@ -14,7 +14,7 @@ use Mage\Task\Exception\ErrorException;
use Mage\Task\BuiltIn\FS\RemoveTask;
use Exception;
use Mage\Tests\Runtime\RuntimeMockup;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
class RemoveTaskTest extends TestCase
{

View file

@ -5,8 +5,9 @@ namespace Mage\tests\Task\BuiltIn\Symfony;
use Mage\Task\BuiltIn\Symfony\AsseticDumpTask;
use Mage\Tests\Runtime\RuntimeMockup;
use PHPUnit\Framework\TestCase;
class AsseticDumpTaskTest extends \PHPUnit_Framework_TestCase
class AsseticDumpTaskTest extends TestCase
{
/**
* @var RuntimeMockup

View file

@ -17,7 +17,7 @@ use Mage\Runtime\Runtime;
use Mage\Runtime\Exception\RuntimeException;
use Exception;
use Mage\Tests\MageApplicationMockup;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Tester\CommandTester;
class TaskFactoryTest extends TestCase

View file

@ -13,7 +13,7 @@ namespace Mage\Tests;
use Mage\Utils;
use Mage\Runtime\Runtime;
use DateTime;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;
class UtilsTest extends TestCase
{