Drop support for PHP < 7.2 and improve test matrix (#868)

* travis: use explicit test matrix and drop PHP < 7.2

* composer: use more liberal version requirements for orchestra

This is to easier satisfy when we want to use older Laravel versions on travis

* tests: add shim for assertStringContainsString for older Laravel/phpunit versions

Specifically, Laravel 5.5 works with an older phpunit version, which
does not feature assertStringContainsString

* composer: bump minimum PHP version to 7.2

* travis: explicitly install Mockery for testing older Laravel versions

* composer: make mockery a root requirement and remove the one from travis

* travis: further improve based on suggestions from https://github.com/fruitcake/laravel-cors/blob/master/.travis.yml

* tests: skip test if mixin markers are already present in model

We're also testing Laravel 5.5 which contains them (they were removed later)
This commit is contained in:
Markus Podar
2020-01-02 14:39:34 +01:00
committed by Barry vd. Heuvel
parent 44f289f76a
commit 015cc6c493
3 changed files with 51 additions and 25 deletions
+44 -18
View File
@@ -7,33 +7,59 @@ cache:
env: env:
global: global:
- RUN_PHPUNIT=1
- RUN_PHPCS=0 - RUN_PHPCS=0
matrix: matrix:
include: include:
- php: 7.0 - php: '7.2'
env: RUN_PHPUNIT=0 env: LARAVEL='5.5.*' COMPOSER_FLAGS='--prefer-lowest'
- php: 7.0 - php: '7.2'
env: RUN_PHPUNIT=0 COMPOSER_FLAGS="--prefer-stable --prefer-lowest" env: LARAVEL='5.5.*' COMPOSER_FLAGS='--prefer-stable'
- php: 7.1 - php: '7.2'
env: RUN_PHPUNIT=0 env: LARAVEL='5.8.*' COMPOSER_FLAGS='--prefer-lowest'
- php: 7.2 - php: '7.2'
- php: 7.3 env: LARAVEL='5.8.*' COMPOSER_FLAGS='--prefer-stable'
- php: 7.4 - php: '7.2'
env: RUN_PHPCS=1 env: LARAVEL='^6.0' COMPOSER_FLAGS='--prefer-lowest'
- php: '7.2'
env: LARAVEL='^6.0' COMPOSER_FLAGS='--prefer-stable'
- php: '7.3'
env: LARAVEL='5.5.*' COMPOSER_FLAGS='--prefer-lowest'
- php: '7.3'
env: LARAVEL='5.5.*' COMPOSER_FLAGS='--prefer-stable'
- php: '7.3'
env: LARAVEL='5.8.*' COMPOSER_FLAGS='--prefer-lowest'
- php: '7.3'
env: LARAVEL='5.8.*' COMPOSER_FLAGS='--prefer-stable'
- php: '7.3'
env: LARAVEL='^6.0' COMPOSER_FLAGS='--prefer-lowest'
- php: '7.3'
env: LARAVEL='^6.0' COMPOSER_FLAGS='--prefer-stable'
- php: '7.4'
env: LARAVEL='5.5.*' COMPOSER_FLAGS='--prefer-lowest'
- php: '7.4'
env: LARAVEL='5.5.*' COMPOSER_FLAGS='--prefer-stable'
- php: '7.4'
env: LARAVEL='5.8.*' COMPOSER_FLAGS='--prefer-lowest'
- php: '7.4'
env: LARAVEL='5.8.*' COMPOSER_FLAGS='--prefer-stable'
- php: '7.4'
env: LARAVEL='^6.0' COMPOSER_FLAGS='--prefer-lowest'
- php: '7.4'
env: LARAVEL='^6.0' COMPOSER_FLAGS='--prefer-stable' RUN_PHPCS=1
before_script: before_script:
- phpenv config-rm xdebug.ini || true - phpenv config-rm xdebug.ini || true
install: install:
- | - travis_retry composer remove phpro/grumphp --no-interaction --no-update --dev
if [[ $RUN_PHPUNIT = 0 ]]; then - composer require "illuminate/support:${LARAVEL}" --no-interaction --no-update
# We assume the older PHP/Laravel versions and thus restore a working dependency system for them - composer require "illuminate/console:${LARAVEL}" --no-interaction --no-update
composer remove --dev orchestra/testbench --no-interaction --no-update - composer require "illuminate/filesystem:${LARAVEL}" --no-interaction --no-update
fi - composer require --dev "illuminate/config:${LARAVEL}" --no-interaction --no-update
- travis_wait 20 travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-dist - composer require --dev "illuminate/view:${LARAVEL}" --no-interaction --no-update
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-dist --no-suggest
script: script:
- vendor/bin/phpunit
- if [[ $RUN_PHPCS = 1 ]]; then vendor/bin/phpcs --standard=psr2 src/; fi - if [[ $RUN_PHPCS = 1 ]]; then vendor/bin/phpcs --standard=psr2 src/; fi
- if [[ $RUN_PHPUNIT = 1 ]]; then vendor/bin/phpunit; fi
+3 -2
View File
@@ -10,7 +10,7 @@
} }
], ],
"require": { "require": {
"php": ">=7", "php": ">=7.2",
"illuminate/support": "^5.5|^6", "illuminate/support": "^5.5|^6",
"illuminate/console": "^5.5|^6", "illuminate/console": "^5.5|^6",
"illuminate/filesystem": "^5.5|^6", "illuminate/filesystem": "^5.5|^6",
@@ -23,7 +23,8 @@
"illuminate/view": "^5.5|^6", "illuminate/view": "^5.5|^6",
"phpro/grumphp": "^0.14", "phpro/grumphp": "^0.14",
"squizlabs/php_codesniffer": "^3", "squizlabs/php_codesniffer": "^3",
"orchestra/testbench": "^4.4" "orchestra/testbench": "^3|^4",
"mockery/mockery": "^1.3"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
+4 -5
View File
@@ -14,12 +14,11 @@ class EloquentCommandTest extends TestCase
public function testCommand() public function testCommand()
{ {
$modelFilename = $this->getVendorModelFilename(); $modelFilename = $this->getVendorModelFilename();
// Ensure the mixins are not present
$modelSource = file_get_contents($modelFilename); $modelSource = file_get_contents($modelFilename);
$this->assertStringNotContainsString('* @mixin \\Eloquent', $modelSource); if (false !== strpos($modelSource, '* @mixin')) {
$this->assertStringNotContainsString('* @mixin \\Illuminate\\Database\\Eloquent\\Builder', $modelSource); $msg = sprintf('Class %s already contains the @mixin markers', Model::class);
$this->assertStringNotContainsString('* @mixin \\Illuminate\\Database\\Query\\Builder', $modelSource); $this->markTestSkipped($msg);
}
$actualContent = null; $actualContent = null;
$mockFilesystem = Mockery::mock(Filesystem::class); $mockFilesystem = Mockery::mock(Filesystem::class);