Skip to content

Commit

Permalink
Merge pull request #8 from facile-it/symfony-6
Browse files Browse the repository at this point in the history
Symfony 6 support, drop older versions
  • Loading branch information
Jean85 authored Apr 3, 2023
2 parents 56c6532 + fdd264d commit b1ea44f
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 36 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,30 @@ on:

jobs:
Tests:
name: PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}
name: PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}${{ matrix.dependencies }}
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental == true }}
env:
SYMFONY_DEPRECATIONS_HELPER: 'max[self]=0'
strategy:
matrix:
php:
- '8.2'
- '8.1'
- '8.0'
- '7.4'
- '7.3'
symfony: ['']
experimental: [false]
include:
- symfony: '^4.4'
- symfony: '^5.4'
os: 'ubuntu-latest'
php: '7.4'
- symfony: '^3.4'
- symfony: '^4.4'
os: 'ubuntu-latest'
php: '7.4'
- description: 'Prefer lowest'
os: 'ubuntu-latest'
php: '7.3'
php: '7.4'
dependencies: '--prefer-lowest'
env:
SYMFONY_DEPRECATIONS_HELPER: 'disabled'
Expand Down
4 changes: 2 additions & 2 deletions .php_cs.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
new Facile\CodingStandards\Rules\ArrayRulesProvider($additionalRules),
]);

$config = PhpCsFixer\Config::create();
$config = new PhpCsFixer\Config();
$config->setRules($rulesProvider->getRules());
$config->setRiskyAllowed(true);

$finder = PhpCsFixer\Finder::create();
$finder = new PhpCsFixer\Finder();

$autoloadPathProvider = new Facile\CodingStandards\AutoloadPathProvider();
$finder->in($autoloadPathProvider->getPaths());
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## Unreleased
* ...
* Drop support to PHP 7.3
* Drop support to EOL Symfony versions (3.x, 4.0 to 4.3, 5.0 to 5.3)

## 1.1.1 [2023-04-03]
* Drop `phpspec/prophecy-phpunit` as a dependency, move it to `require-dev`
Expand Down
22 changes: 13 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
"type": "library",
"license": "MIT",
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"facile-it/facile-coding-standard": true,
"phpstan/extension-installer": true
}
},
"bin": [
"bin/terminable-loop-command.sh"
Expand All @@ -26,17 +30,17 @@
}
},
"require": {
"php": "^7.3 | ^8.0",
"php": "^7.4 | ^8.0",
"ext-pcntl": "*",
"symfony/console": "^3.4 | ^4.0 | ^5.0"
"symfony/console": "^4.4 | ^5.4 | ^6.0"
},
"require-dev": {
"facile-it/facile-coding-standard": "^0.4.0",
"jangregor/phpstan-prophecy": "^0.8.1",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12.55",
"phpstan/phpstan-phpunit": "^0.12.16",
"phpunit/phpunit": "^8.5.14 | ^9.5.2",
"facile-it/facile-coding-standard": "^0.5.2",
"jangregor/phpstan-prophecy": "^1.0.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.3",
"phpunit/phpunit": "^9.6.6",
"phpspec/prophecy-phpunit": "^2.0",
"symfony/phpunit-bridge": "^5.2",
"vimeo/psalm": "^4.6"
Expand Down
22 changes: 11 additions & 11 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
bootstrap="vendor/autoload.php"
executionOrder="depends,defects"
cacheResult="false"
colors="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
verbose="true">
<testsuites>
<testsuite name="default">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<testsuites>
<testsuite name="default">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
</phpunit>
2 changes: 1 addition & 1 deletion tests/E2E/TerminateCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function testSigTermDuringSleep(): void
$this->assertCommandIsFound($process);
$this->assertStringContainsString('Starting ' . self::STUB_COMMAND, $process->getOutput());
$this->assertStringNotContainsString('Signal received, skipping execution', $process->getOutput());
$this->assertRegExp('/Slept (0|1) second\(s\)/', $process->getOutput());
$this->assertMatchesRegularExpression('/Slept (0|1) second\(s\)/', $process->getOutput());
$this->assertSame(143, $process->getExitCode());
}

Expand Down
13 changes: 5 additions & 8 deletions tests/Unit/AbstractTerminableCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Symfony\Bridge\PhpUnit\ClockMock;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

Expand Down Expand Up @@ -39,7 +40,6 @@ protected function commandBody(InputInterface $input, OutputInterface $output):
}
};

$input = $this->prophesize(InputInterface::class);
$output = $this->prophesize(OutputInterface::class);
$output->writeln(Argument::containingString('Starting'), OutputInterface::VERBOSITY_VERBOSE)
->shouldBeCalledTimes(1);
Expand All @@ -50,7 +50,7 @@ protected function commandBody(InputInterface $input, OutputInterface $output):

ClockMock::withClockMock(true);
$start = ClockMock::time();
$exitCode = $stubCommand->run($input->reveal(), $output->reveal());
$exitCode = $stubCommand->run(new ArrayInput([]), $output->reveal());
$end = ClockMock::time();

$this->assertSame(0, $exitCode);
Expand All @@ -69,14 +69,13 @@ protected function commandBody(InputInterface $input, OutputInterface $output):
}
};

$input = $this->prophesize(InputInterface::class);
$output = $this->prophesize(OutputInterface::class);
$output->writeln(Argument::containingString('Starting'), OutputInterface::VERBOSITY_VERBOSE)
->shouldBeCalledTimes(1);

$this->expectException(\InvalidArgumentException::class);

$stubCommand->run($input->reveal(), $output->reveal());
$stubCommand->run(new ArrayInput([]), $output->reveal());
}

/**
Expand All @@ -102,14 +101,13 @@ protected function commandBody(InputInterface $input, OutputInterface $output):
}
};

$input = $this->prophesize(InputInterface::class);
$output = $this->prophesize(OutputInterface::class);
$output->writeln(Argument::containingString('Starting'), OutputInterface::VERBOSITY_VERBOSE)
->shouldBeCalledTimes(1);
$output->writeln('Signal received, terminating with exit code 143', OutputInterface::VERBOSITY_NORMAL)
->shouldBeCalledTimes(1);

$exitCode = $stubCommand->run($input->reveal(), $output->reveal());
$exitCode = $stubCommand->run(new ArrayInput([]), $output->reveal());

$this->assertSame(143, $exitCode);
}
Expand All @@ -126,7 +124,6 @@ protected function commandBody(InputInterface $input, OutputInterface $output):
}
};

$input = $this->prophesize(InputInterface::class);
$output = $this->prophesize(OutputInterface::class);
$output->writeln(Argument::containingString('Starting'), OutputInterface::VERBOSITY_VERBOSE)
->shouldBeCalledTimes(1)
Expand All @@ -136,7 +133,7 @@ protected function commandBody(InputInterface $input, OutputInterface $output):
$output->writeln('Signal received, skipping execution', OutputInterface::VERBOSITY_NORMAL)
->shouldBeCalledTimes(1);

$exitCode = $stubCommand->run($input->reveal(), $output->reveal());
$exitCode = $stubCommand->run(new ArrayInput([]), $output->reveal());

$this->assertSame(143, $exitCode);
}
Expand Down

0 comments on commit b1ea44f

Please sign in to comment.