Skip to content

Commit

Permalink
Drop support for old php and phpunit versions (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilario-pierbattista authored Dec 17, 2021
1 parent 59efb45 commit 5ddb6db
Show file tree
Hide file tree
Showing 96 changed files with 412 additions and 378 deletions.
3 changes: 2 additions & 1 deletion .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM php:7.4-cli-alpine3.14
ARG BASE_IMAGE=php:7.4-cli-alpine3.14
FROM ${BASE_IMAGE}

RUN php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer
RUN apk add --no-cache python3 \
Expand Down
19 changes: 5 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,19 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: [5.5, 5.6, 7.0, 7.1, 7.2, 7.3, 7.4]
php: [7.1, 7.4, 8.0]
dependencies:
- "lowest"
- "highest"
include:
- { php: 8.1, dependencies: "highest" }
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Remove dev dependecies for older php versions
if: ${{ matrix.php < 7.1 }}
run: |
composer remove --dev phpstan/phpstan --ignore-platform-reqs --no-update
composer remove --dev psalm/phar --ignore-platform-reqs --no-update
- name: Install dependencies
uses: ramsey/composer-install@v1
with:
Expand All @@ -37,24 +34,18 @@ jobs:
strategy:
matrix:
include:
- { phpunit: 9, php: 8.1 }
- { phpunit: 9, php: 8.0 }
- { phpunit: 8, php: 7.4 }
- { phpunit: 7, php: 7.3 }
- { phpunit: 6, php: 7.2 }
- { phpunit: 5, php: 7.1 }
- { phpunit: 4, php: 5.6 }
- { phpunit: 6, php: 7.1 }
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Remove dev dependecies for older php versions
if: ${{ matrix.php < 7.1 }}
run: |
composer remove --dev phpstan/phpstan --ignore-platform-reqs --no-update
composer remove --dev psalm/phar --ignore-platform-reqs --no-update
- name: Install dependencies
uses: ramsey/composer-install@v1
- name: Download phpunit phar
Expand Down
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ The project follows [semantic versioning](http://semver.org/). `BC` stands for a
## Unreleased
### Added
* `Eris\Generators` contains all the generator constructors as static methods.
* Support for PHP 8.1
### Changed
* The generator constructors implemented as simple function now call the static methods of `Eris\Generators`. They will be deprecated.
### Removed
* Support for PHP < 7.1

## 0.12.1
### Changed
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.PHONY: run-php-7.4
run-php-7.4:
docker-compose run php-7.4 sh

.PHONY: run-php-8.1
run-php-8.1:
docker-compose run php-8.1 sh
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ This test tries to verify that natural numbers from 0 to 1000 are all smaller th
<?php
use Eris\Generator;

class ReadmeTest extends \PHPUnit_Framework_TestCase
class ReadmeTest extends \PHPUnit\Framework\TestCase
{
use \Eris\TestTrait;

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
],
"license": "MIT",
"require": {
"php": ">=5.5"
"php": ">=7.1"
},
"require-dev": {
"phpunit/phpunit": ">=4.1 <8",
"phpunit/phpunit": ">=7",
"sebastian/comparator": ">=1.2.4",
"friendsofphp/php-cs-fixer": "^2.0",
"icomefromthenet/reverse-regex": "v0.0.6.3",
Expand Down
13 changes: 12 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,20 @@ version: "3.8"

# Add a docker-compose.override.yml if you need to change one of the following (it won't be tracked)
services:
php:
php-7.4:
build:
context: .docker
args:
BASE_IMAGE: php:7.4-cli-alpine3.14
volumes:
- .:/usr/src/eris
user: 1000:1000
working_dir: /usr/src/eris
php-8.1:
build:
context: .docker
args:
BASE_IMAGE: php:8.1-cli-alpine3.14
volumes:
- .:/usr/src/eris
user: 1000:1000
Expand Down
2 changes: 1 addition & 1 deletion examples/AlwaysFailsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Eris\Generators;
use Eris\TestTrait;

class AlwaysFailsTest extends \PHPUnit_Framework_TestCase
class AlwaysFailsTest extends \PHPUnit\Framework\TestCase
{
use TestTrait;

Expand Down
8 changes: 4 additions & 4 deletions examples/AssociativeArrayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use Eris\Generators;

class AssociativeArrayTest extends PHPUnit_Framework_TestCase
class AssociativeArrayTest extends \PHPUnit\Framework\TestCase
{
use Eris\TestTrait;

Expand All @@ -15,11 +15,11 @@ public function testAssociativeArraysGeneratedOnStandardKeys()
])
)
->then(function ($array) {
$this->assertEquals(2, count($array));
$this->assertCount(2, $array);
$letter = $array['letter'];
$this->assertInternalType('string', $letter);
\Eris\PHPUnitDeprecationHelper::assertIsString($letter);
$cipher = $array['cipher'];
$this->assertInternalType('integer', $cipher);
\Eris\PHPUnitDeprecationHelper::assertIsInt($cipher);
});
}
}
2 changes: 1 addition & 1 deletion examples/BindTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use Eris\Generators;

class BindTest extends PHPUnit_Framework_TestCase
class BindTest extends \PHPUnit\Framework\TestCase
{
use Eris\TestTrait;

Expand Down
2 changes: 1 addition & 1 deletion examples/BooleanTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Eris\Generators;
use Eris\TestTrait;

class BooleanTest extends PHPUnit_Framework_TestCase
class BooleanTest extends \PHPUnit\Framework\TestCase
{
use TestTrait;

Expand Down
2 changes: 1 addition & 1 deletion examples/CharacterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Eris\Antecedents;
use Eris\Generators;

class CharacterTest extends PHPUnit_Framework_TestCase
class CharacterTest extends \PHPUnit\Framework\TestCase
{
use Eris\TestTrait;

Expand Down
2 changes: 1 addition & 1 deletion examples/ChooseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Eris\Generators;
use Eris\TestTrait;

class ChooseTest extends PHPUnit_Framework_TestCase
class ChooseTest extends \PHPUnit\Framework\TestCase
{
use TestTrait;

Expand Down
2 changes: 1 addition & 1 deletion examples/CollectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use Eris\Listeners;
use Eris\TestTrait;

class CollectTest extends PHPUnit_Framework_TestCase
class CollectTest extends \PHPUnit\Framework\TestCase
{
use TestTrait;

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

use Eris\Generators;

class ConstantTest extends \PHPUnit_Framework_TestCase
class ConstantTest extends \PHPUnit\Framework\TestCase
{
use Eris\TestTrait;

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

use Eris\Generators;

class DateTest extends PHPUnit_Framework_TestCase
class DateTest extends \PHPUnit\Framework\TestCase
{
use Eris\TestTrait;

Expand Down
2 changes: 1 addition & 1 deletion examples/DifferentElementsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static function C()
}
}

class DifferentElementsTest extends \PHPUnit_Framework_TestCase
class DifferentElementsTest extends \PHPUnit\Framework\TestCase
{
use TestTrait;

Expand Down
2 changes: 1 addition & 1 deletion examples/DisableShrinkingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Eris\Generators;
use Eris\TestTrait;

class DisableShrinkingTest extends \PHPUnit_Framework_TestCase
class DisableShrinkingTest extends \PHPUnit\Framework\TestCase
{
use TestTrait;

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

use Eris\Generators;

class ElementsTest extends \PHPUnit_Framework_TestCase
class ElementsTest extends \PHPUnit\Framework\TestCase
{
use Eris\TestTrait;

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

use Eris\Generators;

class ErrorTest extends \PHPUnit_Framework_TestCase
class ErrorTest extends \PHPUnit\Framework\TestCase
{
use Eris\TestTrait;

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

use Eris\Generators;

class FloatTest extends \PHPUnit_Framework_TestCase
class FloatTest extends \PHPUnit\Framework\TestCase
{
use Eris\TestTrait;

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

use Eris\Generators;

class FrequencyTest extends \PHPUnit_Framework_TestCase
class FrequencyTest extends \PHPUnit\Framework\TestCase
{
use Eris\TestTrait;

Expand Down
4 changes: 2 additions & 2 deletions examples/GeneratorSamplesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Eris\Generators;
use Eris\TestTrait;

class GeneratorSamplesTest extends PHPUnit_Framework_TestCase
class GeneratorSamplesTest extends \PHPUnit\Framework\TestCase
{
use TestTrait;

Expand Down Expand Up @@ -36,7 +36,7 @@ private function generateSample($description, $generator)
echo PHP_EOL;
echo $description . " with size 10";
$sample = $this->sample($generator);
$this->assertInternalType('array', $sample->collected());
\Eris\PHPUnitDeprecationHelper::assertIsArray($sample->collected());
$this->prettyPrint($sample->collected());
}

Expand Down
2 changes: 1 addition & 1 deletion examples/IntegerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Eris\Generators;
use Eris\TestTrait;

class IntegerTest extends PHPUnit_Framework_TestCase
class IntegerTest extends \PHPUnit\Framework\TestCase
{
use TestTrait;

Expand Down
4 changes: 2 additions & 2 deletions examples/LimitToTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Eris\Generators;
use Eris\TestTrait;

class LimitToTest extends PHPUnit_Framework_TestCase
class LimitToTest extends \PHPUnit\Framework\TestCase
{
use TestTrait;

Expand All @@ -16,7 +16,7 @@ public function testNumberOfIterationsCanBeConfigured()
Generators::int()
)
->then(function ($value) {
$this->assertInternalType('integer', $value);
\Eris\PHPUnitDeprecationHelper::assertIsInt($value);
});
}

Expand Down
8 changes: 4 additions & 4 deletions examples/LogFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
use Eris\Listeners;
use Eris\TestTrait;

class LogFileTest extends PHPUnit_Framework_TestCase
class LogFileTest extends \PHPUnit\Framework\TestCase
{
use TestTrait;

public function testWritingIterationsOnALogFile()
public function testWritingIterationsOnALogFile(): void
{
$this
->forAll(
Generators::int()
)
->hook(Listeners::log(sys_get_temp_dir().'/eris-log-file-test.log'))
->then(function ($number) {
$this->assertInternalType('integer', $number);
\Eris\PHPUnitDeprecationHelper::assertIsInt($number);
});
}

public function testLogOfFailuresAndShrinking()
public function testLogOfFailuresAndShrinking(): void
{
$this
->forAll(
Expand Down
2 changes: 1 addition & 1 deletion examples/MapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use Eris\Generators;

class MapTest extends PHPUnit_Framework_TestCase
class MapTest extends \PHPUnit\Framework\TestCase
{
use Eris\TestTrait;

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

use Eris\Generators;

class MinimumEvaluationsTest extends PHPUnit_Framework_TestCase
class MinimumEvaluationsTest extends \PHPUnit\Framework\TestCase
{
use Eris\TestTrait;

Expand Down
6 changes: 3 additions & 3 deletions examples/NamesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Eris\Generator;
use Eris\Generators;

class NamesTest extends PHPUnit_Framework_TestCase
class NamesTest extends \PHPUnit\Framework\TestCase
{
use Eris\TestTrait;

Expand All @@ -12,7 +12,7 @@ public function testGeneratingNames()
$this->forAll(
Generators::names()
)->then(function ($name) {
$this->assertInternalType('string', $name);
\Eris\PHPUnitDeprecationHelper::assertIsString($name);
var_dump($name);
});
}
Expand All @@ -21,7 +21,7 @@ public function testSamplingShrinkingOfNames()
{
$generator = Generator\NamesGenerator::defaultDataSet();
$sample = $this->sampleShrink($generator);
$this->assertInternalType('array', $sample->collected());
\Eris\PHPUnitDeprecationHelper::assertIsArray($sample->collected());
var_dump($sample->collected());
}
}
Loading

0 comments on commit 5ddb6db

Please sign in to comment.