Skip to content

Commit 0f6382f

Browse files
authored
Merge pull request #25 from loic425/fix/excluding-specifications
Fixing exclusions and adding support for php 8
2 parents 4cf8fa4 + 0bfa40f commit 0f6382f

File tree

4 files changed

+73
-11
lines changed

4 files changed

+73
-11
lines changed

.github/workflows/build.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Build
2+
3+
on:
4+
push: ~
5+
pull_request: ~
6+
release:
7+
types: [created]
8+
schedule:
9+
-
10+
cron: "0 1 * * 6" # Run at 1am every Saturday
11+
12+
jobs:
13+
tests:
14+
runs-on: ubuntu-latest
15+
name: "PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}"
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
php: ["7.3", "7.4", "8.0"]
20+
symfony: ["4.4.*", "5.1.*"]
21+
22+
steps:
23+
-
24+
uses: actions/checkout@v2
25+
26+
-
27+
name: Setup PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: "${{ matrix.php }}"
31+
coverage: none
32+
33+
-
34+
name: Update Symfony version
35+
if: matrix.symfony != ''
36+
run: |
37+
composer require symfony/dependency-injection:${{ matrix.symfony }} --no-update --no-scripts
38+
39+
-
40+
name: Install dependencies
41+
run: composer update
42+
43+
-
44+
name: Run analysis
45+
run: composer analyse
46+
47+
-
48+
name: Run tests
49+
run: composer test

.travis.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
language: php
22

33
php:
4-
- 7.1
5-
- 7.2
4+
- 7.3
5+
- 7.4
6+
- 8.0
67

78
env:
8-
- SYMFONY_VERSION="3.4.*"
9-
- SYMFONY_VERSION="4.1.*"
9+
- SYMFONY_VERSION="4.4.*"
10+
- SYMFONY_VERSION="5.1.*"
1011

1112
cache:
1213
directories:

composer.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,28 @@
99
}
1010
],
1111
"require": {
12-
"php": "^7.1",
12+
"php": "^7.1|^8.0",
1313

1414
"behat/behat": "^3.4",
1515
"symfony/dependency-injection": "^3.4|^4.1"
1616
},
1717
"require-dev": {
1818
"friends-of-behat/test-context": "^1.1",
19-
"phpspec/phpspec": "^5.0"
19+
"phpspec/phpspec": "^7.0"
2020
},
2121
"autoload": {
2222
"psr-4": { "FriendsOfBehat\\ExcludeSpecificationsExtension\\": "src/" }
2323
},
2424
"autoload-dev": {
2525
"psr-4" : { "spec\\FriendsOfBehat\\ExcludeSpecificationsExtension\\": "spec/" }
26+
},
27+
"scripts": {
28+
"analyse": [
29+
"@composer validate --ansi --strict"
30+
],
31+
"test": [
32+
"vendor/bin/phpspec run --format dot -vvv --no-interaction",
33+
"vendor/bin/behat -f progress --strict -vvv --no-interaction --colors"
34+
]
2635
}
2736
}

src/Locator/ExcludingSpecificationIterator.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,14 @@ public function __construct(SpecificationIterator $specificationIterator, array
4848
*/
4949
public function accept(): bool
5050
{
51-
return !in_array(
52-
$this->current()->getFile(),
53-
$this->skippedPaths,
54-
true
55-
);
51+
foreach ($this->skippedPaths as $skippedPath) {
52+
$files[$skippedPath] = strpos($this->current()->getFile(), $skippedPath);
53+
if (false !== strpos($this->current()->getFile(), $skippedPath)) {
54+
return false;
55+
}
56+
}
57+
58+
return true;
5659
}
5760

5861
/**

0 commit comments

Comments
 (0)