Browse Source

[Discovery One] Upgrade to Symfony 4 and PHPUnit 7

discovery-one
Andrés Montañez 6 years ago
parent
commit
05d9cf0b80
  1. 3
      .travis.yml
  2. 24
      composer.json
  3. 2
      docs/dockers/php7.1/Dockerfile
  4. 4
      src/Mage.php
  5. 6
      src/MageApplication.php
  6. 2
      tests/Command/BuiltIn/Config/DumpCommandTest.php
  7. 2
      tests/Command/BuiltIn/Config/EnvironmentsCommandTest.php
  8. 2
      tests/Command/BuiltIn/DeployCommandMiscTasksTest.php
  9. 2
      tests/Command/BuiltIn/DeployCommandMiscTest.php
  10. 2
      tests/Command/BuiltIn/DeployCommandWithReleasesTest.php
  11. 2
      tests/Command/BuiltIn/DeployCommandWithoutReleasesTest.php
  12. 2
      tests/Command/BuiltIn/Releases/ListCommandTest.php
  13. 2
      tests/Command/BuiltIn/Releases/RollbackCommandTest.php
  14. 2
      tests/Command/BuiltIn/VersionCommandTest.php
  15. 2
      tests/Deploy/StrategyTest.php
  16. 2
      tests/MageApplicationTest.php
  17. 10
      tests/Runtime/ProcessMockup.php
  18. 2
      tests/Runtime/RuntimeTest.php
  19. 2
      tests/Task/AbstractTaskTest.php
  20. 2
      tests/Task/BuiltIn/Composer/BasicComposerTaskTest.php
  21. 2
      tests/Task/BuiltIn/Composer/SelfUpdateTaskTest.php
  22. 2
      tests/Task/BuiltIn/ExecTaskTest.php
  23. 2
      tests/Task/BuiltIn/FileSystem/ChangeModeTaskTest.php
  24. 2
      tests/Task/BuiltIn/FileSystem/CopyTaskTest.php
  25. 2
      tests/Task/BuiltIn/FileSystem/LinkTaskTest.php
  26. 2
      tests/Task/BuiltIn/FileSystem/MoveTaskTest.php
  27. 2
      tests/Task/BuiltIn/FileSystem/RemoveTaskTest.php
  28. 3
      tests/Task/BuiltIn/Symfony/AsseticDumpTaskTest.php
  29. 2
      tests/Task/TaskFactoryTest.php
  30. 2
      tests/UtilsTest.php

3
.travis.yml

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

24
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"],
@ -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"
}
}
}

2
docs/dockers/php7.1/Dockerfile

@ -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

4
src/Mage.php

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

6
src/MageApplication.php

@ -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();

2
tests/Command/BuiltIn/Config/DumpCommandTest.php

@ -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
{

2
tests/Command/BuiltIn/Config/EnvironmentsCommandTest.php

@ -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
{

2
tests/Command/BuiltIn/DeployCommandMiscTasksTest.php

@ -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
{

2
tests/Command/BuiltIn/DeployCommandMiscTest.php

@ -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
{

2
tests/Command/BuiltIn/DeployCommandWithReleasesTest.php

@ -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
{

2
tests/Command/BuiltIn/DeployCommandWithoutReleasesTest.php

@ -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
{

2
tests/Command/BuiltIn/Releases/ListCommandTest.php

@ -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
{

2
tests/Command/BuiltIn/Releases/RollbackCommandTest.php

@ -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
{

2
tests/Command/BuiltIn/VersionCommandTest.php

@ -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
{

2
tests/Deploy/StrategyTest.php

@ -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
{

2
tests/MageApplicationTest.php

@ -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
{

10
tests/Runtime/ProcessMockup.php

@ -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()

2
tests/Runtime/RuntimeTest.php

@ -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;

2
tests/Task/AbstractTaskTest.php

@ -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
{

2
tests/Task/BuiltIn/Composer/BasicComposerTaskTest.php

@ -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
{

2
tests/Task/BuiltIn/Composer/SelfUpdateTaskTest.php

@ -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
{

2
tests/Task/BuiltIn/ExecTaskTest.php

@ -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
{

2
tests/Task/BuiltIn/FileSystem/ChangeModeTaskTest.php

@ -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
{

2
tests/Task/BuiltIn/FileSystem/CopyTaskTest.php

@ -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
{

2
tests/Task/BuiltIn/FileSystem/LinkTaskTest.php

@ -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
{

2
tests/Task/BuiltIn/FileSystem/MoveTaskTest.php

@ -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
{

2
tests/Task/BuiltIn/FileSystem/RemoveTaskTest.php

@ -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
{

3
tests/Task/BuiltIn/Symfony/AsseticDumpTaskTest.php

@ -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

2
tests/Task/TaskFactoryTest.php

@ -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

2
tests/UtilsTest.php

@ -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
{

Loading…
Cancel
Save