mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-26 20:14:46 +01:00
Fix up tests
This commit is contained in:
parent
8c58eb4cd4
commit
544aee1671
58
.travis.yml
58
.travis.yml
@ -1,35 +1,41 @@
|
||||
language: php
|
||||
dist: xenial
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.composer/cache
|
||||
before_install: composer self-update --2
|
||||
|
||||
php:
|
||||
- 7.0
|
||||
- 7.1
|
||||
- 7.2
|
||||
- 7.3
|
||||
- 7.4
|
||||
- nightly
|
||||
|
||||
install:
|
||||
- if [ $TRAVIS_PHP_VERSION = '7.0' ]; then composer require satooshi/php-coveralls '~1.0'; fi
|
||||
- |
|
||||
if [ $TRAVIS_PHP_VERSION = 'nightly' ]; then
|
||||
composer install --prefer-dist --ignore-platform-reqs;
|
||||
else
|
||||
composer install --prefer-dist;
|
||||
fi
|
||||
install: composer update --no-progress --prefer-dist
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- name: PHP 7.0 Unit Tests
|
||||
php: 7.0
|
||||
install:
|
||||
- composer require php-coveralls/php-coveralls:^2.2 --dev --no-update
|
||||
- composer update --no-progress --prefer-dist
|
||||
script: vendor/bin/phpunit --coverage-clover build/logs/clover.xml
|
||||
after_success: php vendor/bin/coveralls
|
||||
- name: PHP 7.1 Unit Tests
|
||||
php: 7.1
|
||||
- name: PHP 7.2 Unit Tests
|
||||
php: 7.2
|
||||
- name: PHP 7.3 Unit Tests
|
||||
php: 7.3
|
||||
- name: PHP 7.4 Unit Tests
|
||||
php: 7.4
|
||||
- name: PHP 8.0 Unit Tests
|
||||
php: nightly
|
||||
install:
|
||||
- composer update --ignore-platform-req=php --no-progress --prefer-dist
|
||||
- name: PHP 7 Integration Tests
|
||||
php: 7.4
|
||||
script:
|
||||
- test_old/run-php-src.sh 7
|
||||
- name: PHP 8 Integration Tests
|
||||
php: 7.4
|
||||
script:
|
||||
- test_old/run-php-src.sh 8
|
||||
allow_failures:
|
||||
- php: nightly
|
||||
- name: PHP 8 Integration Tests
|
||||
fast_finish: true
|
||||
|
||||
script:
|
||||
- if [ $TRAVIS_PHP_VERSION = '7.0' ]; then vendor/bin/phpunit --coverage-clover build/logs/clover.xml; else vendor/bin/phpunit; fi
|
||||
- if [ $TRAVIS_PHP_VERSION = '7.2' ]; then test_old/run-php-src.sh; fi
|
||||
|
||||
after_success:
|
||||
- if [ $TRAVIS_PHP_VERSION = '7.0' ]; then php vendor/bin/coveralls; fi
|
||||
script: vendor/bin/phpunit
|
||||
|
@ -1,5 +1,9 @@
|
||||
VERSION="master"
|
||||
if [[ $1 == '7' ]]; then
|
||||
VERSION='fa9bd812fcab6dfd6d9b506cb3cb04dfa75d239d'
|
||||
else
|
||||
VERSION='05478e985eb50c473054b4f1bf174f48ead78784'
|
||||
fi
|
||||
wget -q https://github.com/php/php-src/archive/$VERSION.tar.gz
|
||||
mkdir -p ./data/php-src
|
||||
tar -xzf ./$VERSION.tar.gz -C ./data/php-src --strip-components=1
|
||||
php -n test_old/run.php --verbose --no-progress PHP7 ./data/php-src
|
||||
php -n test_old/run.php --verbose --no-progress PHP$1 ./data/php-src
|
||||
|
@ -14,7 +14,7 @@ This script has to be called with the following signature:
|
||||
|
||||
php run.php [--no-progress] testType pathToTestFiles
|
||||
|
||||
The test type must be one of: PHP5, PHP7 or Symfony.
|
||||
The test type must be one of: PHP5, PHP7, PHP8 or Symfony.
|
||||
|
||||
The following options are available:
|
||||
|
||||
@ -39,7 +39,7 @@ foreach ($argv as $arg) {
|
||||
}
|
||||
|
||||
if (count($arguments) !== 2) {
|
||||
showHelp('Too little arguments passed!');
|
||||
showHelp('Too few arguments passed!');
|
||||
}
|
||||
|
||||
$showProgress = true;
|
||||
@ -57,9 +57,12 @@ foreach ($options as $option) {
|
||||
$testType = $arguments[0];
|
||||
$dir = $arguments[1];
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
switch ($testType) {
|
||||
case 'Symfony':
|
||||
$version = 'Php7';
|
||||
$parserVersion = 'Php7';
|
||||
$lexerVersion = PhpParser\Lexer\Emulative::PHP_7_3;
|
||||
$fileFilter = function($path) {
|
||||
if (!preg_match('~\.php$~', $path)) {
|
||||
return false;
|
||||
@ -84,7 +87,9 @@ switch ($testType) {
|
||||
break;
|
||||
case 'PHP5':
|
||||
case 'PHP7':
|
||||
$version = $testType === 'PHP5' ? 'Php5' : 'Php7';
|
||||
case 'PHP8':
|
||||
$parserVersion = $testType === 'PHP5' ? 'Php5' : 'Php7';
|
||||
$lexerVersion = $testType === 'PHP8' ? PhpParser\Lexer\Emulative::PHP_8_0 : PhpParser\Lexer\Emulative::PHP_7_4;
|
||||
$fileFilter = function($path) {
|
||||
return preg_match('~\.phpt$~', $path);
|
||||
};
|
||||
@ -129,15 +134,16 @@ switch ($testType) {
|
||||
};
|
||||
break;
|
||||
default:
|
||||
showHelp('Test type must be one of: PHP5, PHP7 or Symfony');
|
||||
showHelp('Test type must be one of: PHP5, PHP7, PHP8 or Symfony');
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
$lexer = new PhpParser\Lexer\Emulative(['usedAttributes' => [
|
||||
'comments', 'startLine', 'endLine', 'startTokenPos', 'endTokenPos',
|
||||
]]);
|
||||
$parserName = 'PhpParser\Parser\\' . $version;
|
||||
$lexer = new PhpParser\Lexer\Emulative([
|
||||
'usedAttributes' => [
|
||||
'comments', 'startLine', 'endLine', 'startTokenPos', 'endTokenPos',
|
||||
],
|
||||
'phpVersion' => $lexerVersion,
|
||||
]);
|
||||
$parserName = 'PhpParser\Parser\\' . $parserVersion;
|
||||
/** @var PhpParser\Parser $parser */
|
||||
$parser = new $parserName($lexer);
|
||||
$prettyPrinter = new PhpParser\PrettyPrinter\Standard;
|
||||
|
Loading…
Reference in New Issue
Block a user