Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Add support for PHP 7.0 #534

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ branches:
- context: "Refactoring (7.4, locked)"
- context: "Security Analysis (7.4, locked)"
- context: "Static Code Analysis (7.4, locked)"
- context: "Tests (6.5.0, 7.0, highest)"
- context: "Tests (6.5.0, 7.0, lowest)"
- context: "Tests (6.5.0, 7.1, highest)"
- context: "Tests (6.5.0, 7.1, lowest)"
- context: "Tests (6.5.0, 7.2, highest)"
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ jobs:
- "6.5.0"

php-version:
- "7.0"
- "7.1"
- "7.2"
- "7.3"
Expand Down Expand Up @@ -688,9 +689,13 @@ jobs:
run: "composer config platform.php --ansi --unset"

- name: "Require phpunit/phpunit:^${{ matrix.phpunit-version }}"
if: "matrix.dependencies != 'locked'"
if: "matrix.dependencies != 'locked' && matrix.phpunit-version != '6.5.0'"
run: "composer require phpunit/phpunit:^${{ matrix.phpunit-version }} --ansi --no-interaction --no-progress --update-with-all-dependencies"

- name: "Require fakerphp/faker:^1.9.2 and phpunit/phpunit:^${{ matrix.phpunit-version }}"
if: "matrix.dependencies != 'locked' && matrix.phpunit-version == '6.5.0'"
run: "composer require fakerphp/faker:^1.9.2 phpunit/phpunit:^${{ matrix.phpunit-version }} --ansi --no-interaction --no-progress --update-with-all-dependencies"

- name: "Install ${{ matrix.dependencies }} dependencies with composer"
uses: "ergebnis/.github/actions/composer/install@1.9.0"
with:
Expand Down
3 changes: 1 addition & 2 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@

$license->save();

$ruleSet = PhpCsFixer\Config\RuleSet\Php71::create()
$ruleSet = PhpCsFixer\Config\RuleSet\Php70::create()
->withHeader($license->header())
->withRules(PhpCsFixer\Config\Rules::fromArray([
'mb_str_functions' => false,
'void_return' => false,
]));

$config = PhpCsFixer\Config\Factory::fromRuleSet($ruleSet);
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ For a full diff see [`2.13.0...main`][2.13.0...main].
### Changed

- Added support for `phpunit/phpunit:^6.5.0` ([#533]), by [@localheinz]
- Added support for PHP 7.0 ([#534]), by [@localheinz]

## [`2.13.0`][2.13.0]

Expand Down Expand Up @@ -318,6 +319,7 @@ For a full diff see [`7afa59c...1.0.0`][7afa59c...1.0.0].
[#531]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/531
[#532]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/532
[#533]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/533
[#534]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/534

[@HypeMC]: https://github.com/HypeMC
[@localheinz]: https://github.com/localheinz
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"security": "https://github.com/ergebnis/phpunit-slow-test-detector/blob/main/.github/SECURITY.md"
},
"require": {
"php": "~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0",
"php": "~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0",
"phpunit/phpunit": "^6.5.0 || ^7.5.0 || ^8.5.19 || ^9.0.0 || ^10.0.0 || ^11.0.0"
},
"require-dev": {
Expand Down
4 changes: 2 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

345 changes: 345 additions & 0 deletions psalm-baseline.xml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
resolveFromConfigFile="true"
strictBinaryOperands="true"
>
<issueHandlers>
<ReservedWord errorLevel="info" />
</issueHandlers>

<plugins>
<pluginClass class="Psalm\PhpUnitPlugin\Plugin" />
</plugins>
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
__DIR__ . '/test/',
]);

$rectorConfig->phpVersion(ValueObject\PhpVersion::PHP_71);
$rectorConfig->phpVersion(ValueObject\PhpVersion::PHP_70);
};
2 changes: 1 addition & 1 deletion src/Collector/Collector.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
interface Collector
{
public function collect(SlowTest $slowTest): void;
public function collect(SlowTest $slowTest);

/**
* @phpstan-return list<SlowTest>
Expand Down
2 changes: 1 addition & 1 deletion src/Collector/DefaultCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class DefaultCollector implements Collector
*/
private $slowTests = [];

public function collect(SlowTest $slowTest): void
public function collect(SlowTest $slowTest)
{
$key = $slowTest->testIdentifier()->toString();

Expand Down
2 changes: 1 addition & 1 deletion src/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@

private function resolveMaximumDuration(string $test): Duration
{
[$testClassName, $testMethodName] = \explode(
list($testClassName, $testMethodName) = \explode(

Check warning on line 356 in src/Extension.php

View check run for this annotation

Codecov / codecov/patch

src/Extension.php#L356

Added line #L356 was not covered by tests
'::',
$test
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
final class SleeperTest extends Framework\TestCase
{
public function testSleeperSleepsLessThanDefaultMaximumDuration(): void
public function testSleeperSleepsLessThanDefaultMaximumDuration()
{
$milliseconds = 10;

Expand All @@ -35,7 +35,7 @@ public function testSleeperSleepsLessThanDefaultMaximumDuration(): void
/**
* @dataProvider provideMillisecondsGreaterThanDefaultMaximumDuration
*/
public function testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider(int $milliseconds): void
public function testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider(int $milliseconds)
{
$sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);

Expand All @@ -47,7 +47,7 @@ public function testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvide
/**
* @return \Generator<int, array{0: int}>
*/
public static function provideMillisecondsGreaterThanDefaultMaximumDuration(): iterable
public static function provideMillisecondsGreaterThanDefaultMaximumDuration(): \Generator
{
$values = \range(
600,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
final class SleeperTest extends Framework\TestCase
{
public function testSleeperSleepsLessThanDefaultMaximumDuration(): void
public function testSleeperSleepsLessThanDefaultMaximumDuration()
{
$milliseconds = 10;

Expand All @@ -35,7 +35,7 @@ public function testSleeperSleepsLessThanDefaultMaximumDuration(): void
/**
* @dataProvider provideMillisecondsGreaterThanDefaultMaximumDuration
*/
public function testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider(int $milliseconds): void
public function testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider(int $milliseconds)
{
$sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);

Expand All @@ -47,7 +47,7 @@ public function testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvide
/**
* @return \Generator<int, array{0: int}>
*/
public static function provideMillisecondsGreaterThanDefaultMaximumDuration(): iterable
public static function provideMillisecondsGreaterThanDefaultMaximumDuration(): \Generator
{
$values = \range(
600,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
final class SleeperTest extends Framework\TestCase
{
public function testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration(): void
public function testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration()
{
$milliseconds = 10;

Expand All @@ -35,7 +35,7 @@ public function testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration():
/**
* @dataProvider provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration
*/
public function testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider(int $milliseconds): void
public function testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider(int $milliseconds)
{
$sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);

Expand All @@ -47,7 +47,7 @@ public function testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWi
/**
* @return \Generator<int, array{0: int}>
*/
public static function provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration(): iterable
public static function provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration(): \Generator
{
$values = \range(
200,
Expand Down
6 changes: 3 additions & 3 deletions test/EndToEnd/Version06/TestCase/Bare/SleeperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
final class SleeperTest extends Framework\TestCase
{
public function testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration(): void
public function testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration()
{
$milliseconds = 10;

Expand All @@ -35,7 +35,7 @@ public function testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration():
/**
* @dataProvider provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration
*/
public function testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider(int $milliseconds): void
public function testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider(int $milliseconds)
{
$sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);

Expand All @@ -47,7 +47,7 @@ public function testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWi
/**
* @return \Generator<int, array{0: int}>
*/
public static function provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration(): iterable
public static function provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration(): \Generator
{
$values = \range(
200,
Expand Down
26 changes: 13 additions & 13 deletions test/EndToEnd/Version06/TestCase/Combination/SleeperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,69 +21,69 @@
*/
final class SleeperTest extends Framework\TestCase
{
public static function setUpBeforeClass(): void
public static function setUpBeforeClass()
{
Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
}

public static function tearDownAfterClass(): void
public static function tearDownAfterClass()
{
Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
}

protected function setUp(): void
protected function setUp()
{
Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
}

protected function assertPreConditions(): void
protected function assertPreConditions()
{
Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
}

protected function assertPostConditions(): void
protected function assertPostConditions()
{
Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
}

protected function tearDown(): void
protected function tearDown()
{
Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
}

/**
* @before
*/
public function sleepWithBeforeAnnotation(): void
public function sleepWithBeforeAnnotation()
{
Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
}

/**
* @beforeClass
*/
public function sleepWithBeforeClassAnnotation(): void
public function sleepWithBeforeClassAnnotation()
{
Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
}

/**
* @after
*/
public function sleepWithAfterAnnotation(): void
public function sleepWithAfterAnnotation()
{
Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
}

/**
* @afterClass
*/
public static function sleepWithAfterClassAnnotation(): void
public static function sleepWithAfterClassAnnotation()
{
Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
}

public function testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration(): void
public function testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration()
{
$milliseconds = 10;

Expand All @@ -97,7 +97,7 @@ public function testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration():
/**
* @dataProvider provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration
*/
public function testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider(int $milliseconds): void
public function testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider(int $milliseconds)
{
$sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);

Expand All @@ -109,7 +109,7 @@ public function testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWi
/**
* @return \Generator<int, array{0: int}>
*/
public static function provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration(): iterable
public static function provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration(): \Generator
{
$values = \range(
200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ final class SleeperTest extends Framework\TestCase
/**
* @after
*/
public function sleepWithAfterAnnotation(): void
public function sleepWithAfterAnnotation()
{
Test\Fixture\Sleeper::fromMilliseconds(100)->sleep();
}

public function testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration(): void
public function testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration()
{
$milliseconds = 10;

Expand All @@ -43,7 +43,7 @@ public function testSleeperSleepsLessThanMaximumDurationFromXmlConfiguration():
/**
* @dataProvider provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration
*/
public function testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider(int $milliseconds): void
public function testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWithDataProvider(int $milliseconds)
{
$sleeper = Test\Fixture\Sleeper::fromMilliseconds($milliseconds);

Expand All @@ -55,7 +55,7 @@ public function testSleeperSleepsLongerThanMaximumDurationFromXmlConfigurationWi
/**
* @return \Generator<int, array{0: int}>
*/
public static function provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration(): iterable
public static function provideMillisecondsGreaterThanMaximumDurationFromXmlConfiguration(): \Generator
{
$values = \range(
200,
Expand Down