Skip to content

Commit

Permalink
[Discovery One] Upgrade to Symfony 4 and PHPUnit 7
Browse files Browse the repository at this point in the history
  • Loading branch information
andres-montanez committed Mar 29, 2018
1 parent 23dae99 commit 05d9cf0
Show file tree
Hide file tree
Showing 30 changed files with 51 additions and 47 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
@@ -1,8 +1,5 @@
language: php
php:
- '5.5'
- '5.6'
- '7.0'
- '7.1'
- '7.2'

Expand Down
24 changes: 12 additions & 12 deletions composer.json
@@ -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"],
Expand All @@ -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": {
Expand All @@ -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"
}
}
}
2 changes: 1 addition & 1 deletion docs/dockers/php7.1/Dockerfile
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/Mage.php
Expand Up @@ -17,6 +17,6 @@
*/
class Mage
{
const VERSION = '3.4.0';
const CODENAME = 'Nostromo';
const VERSION = '4.x';
const CODENAME = 'Discovery One';
}
6 changes: 3 additions & 3 deletions src/MageApplication.php
Expand Up @@ -17,7 +17,7 @@
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;
Expand Down Expand Up @@ -46,12 +46,12 @@ public function __construct($file)
$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();
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/BuiltIn/Config/DumpCommandTest.php
Expand Up @@ -14,7 +14,7 @@
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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/BuiltIn/Config/EnvironmentsCommandTest.php
Expand Up @@ -14,7 +14,7 @@
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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/BuiltIn/DeployCommandMiscTasksTest.php
Expand Up @@ -14,7 +14,7 @@
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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/BuiltIn/DeployCommandMiscTest.php
Expand Up @@ -15,7 +15,7 @@
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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/BuiltIn/DeployCommandWithReleasesTest.php
Expand Up @@ -14,7 +14,7 @@
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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/BuiltIn/DeployCommandWithoutReleasesTest.php
Expand Up @@ -14,7 +14,7 @@
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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/BuiltIn/Releases/ListCommandTest.php
Expand Up @@ -14,7 +14,7 @@
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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/BuiltIn/Releases/RollbackCommandTest.php
Expand Up @@ -14,7 +14,7 @@
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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/BuiltIn/VersionCommandTest.php
Expand Up @@ -15,7 +15,7 @@
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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Deploy/StrategyTest.php
Expand Up @@ -15,7 +15,7 @@
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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/MageApplicationTest.php
Expand Up @@ -14,7 +14,7 @@
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
{
Expand Down
10 changes: 8 additions & 2 deletions tests/Runtime/ProcessMockup.php
Expand Up @@ -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;
}
Expand All @@ -29,7 +29,7 @@ public function setTimeout($timeout)
$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;
Expand All @@ -50,6 +50,12 @@ public function run($callback = null)
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()
Expand Down
2 changes: 1 addition & 1 deletion tests/Runtime/RuntimeTest.php
Expand Up @@ -15,7 +15,7 @@
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;
Expand Down
2 changes: 1 addition & 1 deletion tests/Task/AbstractTaskTest.php
Expand Up @@ -12,7 +12,7 @@

use Mage\Task\Exception\ErrorException;
use Exception;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;

class AbstractTaskTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Task/BuiltIn/Composer/BasicComposerTaskTest.php
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Task/BuiltIn/Composer/SelfUpdateTaskTest.php
Expand Up @@ -6,7 +6,7 @@
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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Task/BuiltIn/ExecTaskTest.php
Expand Up @@ -14,7 +14,7 @@
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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Task/BuiltIn/FileSystem/ChangeModeTaskTest.php
Expand Up @@ -14,7 +14,7 @@
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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Task/BuiltIn/FileSystem/CopyTaskTest.php
Expand Up @@ -14,7 +14,7 @@
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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Task/BuiltIn/FileSystem/LinkTaskTest.php
Expand Up @@ -14,7 +14,7 @@
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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Task/BuiltIn/FileSystem/MoveTaskTest.php
Expand Up @@ -14,7 +14,7 @@
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
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Task/BuiltIn/FileSystem/RemoveTaskTest.php
Expand Up @@ -14,7 +14,7 @@
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
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Task/BuiltIn/Symfony/AsseticDumpTaskTest.php
Expand Up @@ -5,8 +5,9 @@

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
Expand Down
2 changes: 1 addition & 1 deletion tests/Task/TaskFactoryTest.php
Expand Up @@ -17,7 +17,7 @@
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
Expand Down
2 changes: 1 addition & 1 deletion tests/UtilsTest.php
Expand Up @@ -13,7 +13,7 @@
use Mage\Utils;
use Mage\Runtime\Runtime;
use DateTime;
use PHPUnit_Framework_TestCase as TestCase;
use PHPUnit\Framework\TestCase;

class UtilsTest extends TestCase
{
Expand Down

0 comments on commit 05d9cf0

Please sign in to comment.