Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 16 additions & 23 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,42 @@ on:
pull_request:
branches: [ master ]

permissions:
contents: read

jobs:
test:
strategy:
fail-fast: false
matrix:
php-versions: [ '7.4', '8.0', '8.1' ]
include:
- php-versions: '7.4'
coverage: pcov
composer-prefer: '--prefer-lowest --prefer-stable'
phpunit-flags: '--coverage-clover coverage.xml'
php-versions: [ '8.2', '8.3', '8.4', '8.5' ]
Comment on lines 14 to +17

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: ${{ matrix.coverage }}
coverage: none
tools: composer:v2


- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Validate composer.json
run: composer validate --strict --no-check-lock

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-composer-${{ matrix.composer-prefer }}$-${{ hashFiles('**/composer.lock') }}
key: ${{ runner.os }}-composer-${{ matrix.php-versions }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-${{ matrix.composer-prefer }}-
${{ runner.os }}-composer-${{ matrix.php-versions }}-

- name: Install dependencies
run: composer update --prefer-dist --no-progress --ignore-platform-req="ext-*" ${{ matrix.composer-prefer }}
run: composer update --prefer-dist --no-progress --ignore-platform-req="ext-*"

- name: Run phpspec
run: vendor/bin/phpspec run
continue-on-error: true

- name: Upload coverage
if: matrix.coverage
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.xml --revision=${{ github.event.pull_request.head.sha || github.sha }}
run: vendor/bin/phpspec run --config phpspec.yml.dist
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"symfony/validator": "<2.5"
},
"require-dev": {
"phpspec/phpspec": "^7.2",
"friends-of-phpspec/phpspec-code-coverage": "^6.1"
"phpspec/phpspec": "^7.2 || ^8.0",
"friends-of-phpspec/phpspec-code-coverage": "^6.1 || ^7.0"
},
"suggest": {
"symfony/property-access": "Used in MappingStep",
Expand Down
2 changes: 2 additions & 0 deletions spec/Step/ValidatorStepSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ function it_throws_an_exception_during_process_when_validation_fails(
$next = function() {};
$item = ['foo' => true];
$step->process($item, $next)->shouldNotBeCalled();
$violation->getMessage()->willReturn('Invalid value');
$list = new ConstraintViolationList([$violation->getWrappedObject()]);
$validator->validate($item, Argument::type('Symfony\Component\Validator\Constraints\Collection'))->willReturn($list);

Expand Down Expand Up @@ -163,6 +164,7 @@ function it_tracks_lines_when_exceptions_are_thrown_during_process(
{
$numberOfCalls = 3;
$next = function() {};
$violation->getMessage()->willReturn('Invalid value');
$errorList = new ConstraintViolationList([$violation->getWrappedObject()]);
$stepFunc = function($item) use ($step, $next) {
return $step->process($item, $next);
Expand Down
Loading