Skip to content

Commit

Permalink
Bump actions/checkout@v1 to actions/checkout@v2
Browse files Browse the repository at this point in the history
  • Loading branch information
roukmoute committed Mar 1, 2021
1 parent 8772452 commit d50411a
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 44 deletions.
105 changes: 79 additions & 26 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,90 @@ on:
pull_request:

jobs:
tests:
name: Test suite
phpunit:
name: PHPUnit (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
container:
image: php:7.2-cli-alpine
timeout-minutes: 20
strategy:
matrix:
php:
- '7.2'
- '7.3'
- '7.4'
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install project dependencies
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer
ini-values: memory_limit=-1
- name: Update project dependencies
run: composer update --no-interaction --no-progress --ansi
- name: Run PHPUnit tests
run: |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php --filename=composer
php -r "unlink('composer-setup.php');"
php composer global require friendsofphp/php-cs-fixer
php composer global require pedrotroller/php-cs-custom-fixer
php composer install
- name: Run PHP Coding Standards Fixer tool
run: |
php ~/.composer/vendor/bin/php-cs-fixer fix --dry-run --config=.php_cs.dist
php ~/.composer/vendor/bin/php-cs-fixer fix --dry-run --config=.php_cs.test.dist
- name: Run PHPUnit
vendor/bin/phpunit
- name: Run PHPUnit tests with lowest versions of dependencies
if: (!startsWith(matrix.php, '7.4'))
run: |
php ./vendor/bin/phpunit
- name: Run phpspec
composer update --prefer-lowest --no-interaction --no-progress --ansi
vendor/bin/phpunit
phpspec:
name: phpspec (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
php:
- '7.2'
- '7.3'
- '7.4'
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer
ini-values: memory_limit=-1
- name: Update project dependencies
run: composer update --no-interaction --no-progress --ansi
- name: Run PHPUnit tests
run: |
php ./vendor/bin/phpspec run
- name: Run PHPUnit with lowest versions of dependencies
vendor/bin/phpspec run
- name: Run PHPUnit tests with lowest versions of dependencies
run: |
php composer update --prefer-lowest
php ./vendor/bin/phpunit
- name: Run phpspec with lowest versions of dependencies
composer update --prefer-lowest --no-interaction --no-progress --ansi
vendor/bin/phpspec run
php_cs_fixer:
name: PHP-CS-Fixer (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
php:
- '7.2'
- '7.3'
- '7.4'
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer
ini-values: memory_limit=-1
- name: Update project dependencies
run: composer update --no-interaction --no-progress --ansi
- name: Run PHP Coding Standards Fixer tool
run: |
php ./vendor/bin/phpspec run
vendor/bin/php-cs-fixer fix --dry-run --config=.php_cs.dist
vendor/bin/php-cs-fixer fix --dry-run --config=.php_cs.test.dist
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
"type": "library",
"keywords": ["test", "tests", "testing", "DTO"],
"require": {
"php": ">=7.2",
"phpunit/phpunit": "^8.4",
"roave/better-reflection": "^3.5"
"php": "^7.2",
"phpunit/phpunit": "^8.4||^9.1",
"roave/better-reflection": "^3.5||^4.8"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.18",
"pedrotroller/php-cs-custom-fixer": "^2.23",
"phpspec/phpspec": "^6.0"
},
"license": "MIT",
Expand Down
6 changes: 2 additions & 4 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.2/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.4/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
failOnRisky="true"
failOnWarning="true"
>
<php>
<ini name="error_reporting" value="-1" />
Expand All @@ -27,4 +25,4 @@
</exclude>
</whitelist>
</filter>
</phpunit>
</phpunit>
13 changes: 2 additions & 11 deletions src/SortedMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,8 @@ private function checkArgument(string $typeOfValue, $value, int $argumentNb = 1)
if (($value !== null)
&& (!\function_exists($func = 'is_' . $typeOfValue) || !$func($value))
&& !($value instanceof $typeOfValue)) {
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS)[1];
throw new \TypeError(
sprintf(
'Argument %d passed to %s::%s() must be of the type %s, int given',
$argumentNb,
$backtrace['class'],
$backtrace['function'],
$typeOfValue,
gettype($value)
)
);
$backtrace = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS)[1];
throw new \TypeError(sprintf('Argument %d passed to %s::%s() must be of the type %s, int given', $argumentNb, $backtrace['class'], $backtrace['function'], $typeOfValue, gettype($value)));
}
}
}

0 comments on commit d50411a

Please sign in to comment.