Skip to content

Commit 278a8af

Browse files
authored
Merge pull request #8 from webfactory/run-phpunit-workflow
Run PHPUnit as GitHub Actions workflow
2 parents 16604e3 + bcda741 commit 278a8af

3 files changed

Lines changed: 48 additions & 1 deletion

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
sed --in-place --regexp-extended --expression='s/"(symfony\/.*)": "\^.*"/"\1": "'$VERSION'"/' composer.json

.github/workflows/tests.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
env:
10+
SYMFONY_DEPRECATIONS_HELPER: weak
11+
PHP_VERSION: 7.2
12+
13+
jobs:
14+
PHPUnit:
15+
16+
runs-on: ubuntu-20.04
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- { symfony-locked-version: none, dependency-version: prefer-lowest }
22+
- { symfony-locked-version: 3.4.*, dependency-version: prefer-stable }
23+
- { symfony-locked-version: 4.4.*, dependency-version: prefer-stable }
24+
name: PHPUnit (Symfony Version Lock ${{ matrix.symfony-locked-version }}, ${{ matrix.dependency-version }})
25+
steps:
26+
- uses: actions/checkout@v2
27+
- uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ env.PHP_VERSION }}
30+
tools: composer:v2
31+
- uses: actions/cache@v2
32+
with:
33+
path: vendor
34+
key: composer-${{ runner.os }}-${{ env.PHP_VERSION }}-${{ matrix.symfony-locked-version }}-${{ matrix.dependency-version }}-${{ hashFiles('composer.json', 'composer.lock') }}
35+
restore-keys: |
36+
composer-${{ runner.os }}-${{ env.PHP_VERSION }}-${{ matrix.symfony-locked-version }}-${{ matrix.dependency-version }}-
37+
composer-${{ runner.os }}-${{ env.PHP_VERSION }}-
38+
composer-${{ runner.os }}-
39+
- run: VERSION=${{ matrix.symfony-locked-version }} .github/workflows/lock-symfony-version.sh
40+
if: matrix.symfony-locked-version != 'none'
41+
- run: composer update --${{ matrix.dependency-version }} --no-interaction --no-scripts --no-progress --prefer-dist
42+
- run: composer show
43+
- run: vendor/bin/phpunit

DependencyInjection/Configuration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ class Configuration implements ConfigurationInterface
1010
public function getConfigTreeBuilder()
1111
{
1212
$treeBuilder = new TreeBuilder('webfactory_shortcode');
13+
$rootNode = method_exists(TreeBuilder::class, 'getRootNode') ? $treeBuilder->getRootNode() : $treeBuilder->root('webfactory_shortcode');
1314

1415
// For details on these configuration options, see https://github.com/thunderer/Shortcode#parsing and
1516
// https://github.com/thunderer/Shortcode#configuration .
16-
$treeBuilder->getRootNode()
17+
$rootNode
1718
->children()
1819
->enumNode('parser')
1920
->info('Which parser type to use, choose "regular" or "regex".')

0 commit comments

Comments
 (0)