Skip to content

Commit a6ba40b

Browse files
authored
Merge pull request #122 from spatie/php8-support
Php8 support
2 parents 84f2c26 + 0187f99 commit a6ba40b

File tree

11 files changed

+112
-66
lines changed

11 files changed

+112
-66
lines changed
File renamed without changes.

.github/workflows/php-cs-fixer.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Check & fix styling
2+
3+
on: [push]
4+
5+
jobs:
6+
php-cs-fixer:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v2
12+
with:
13+
ref: ${{ github.head_ref }}
14+
15+
- name: Run PHP CS Fixer
16+
uses: docker://oskarstark/php-cs-fixer-ga
17+
with:
18+
args: --config=.php_cs.dist --allow-risky=yes
19+
20+
- name: Commit changes
21+
uses: stefanzweifel/git-auto-commit-action@v4
22+
with:
23+
commit_message: Fix styling

.github/workflows/run-tests.yml

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,36 @@
1-
name: run-tests
1+
name: Tests
22

33
on: [push, pull_request]
44

55
jobs:
6-
test:
7-
8-
runs-on: ${{ matrix.os }}
9-
strategy:
10-
fail-fast: true
11-
matrix:
12-
os: [ubuntu-latest, windows-latest]
13-
php: [7.4, 8.0]
14-
dependency-version: [prefer-lowest, prefer-stable]
15-
16-
name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
17-
18-
steps:
19-
- name: Checkout code
20-
uses: actions/checkout@v1
21-
22-
- name: Cache dependencies
23-
uses: actions/cache@v1
24-
with:
25-
path: ~/.composer/cache/files
26-
key: dependencies-php-${{ matrix.php }}-${{ matrix.os }}-composer-${{ hashFiles('composer.json') }}
27-
28-
- name: Setup PHP
29-
uses: shivammathur/setup-php@v1
30-
with:
31-
php-version: ${{ matrix.php }}
32-
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
33-
coverage: none
34-
35-
- name: Install dependencies
36-
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
37-
38-
- name: Execute tests
39-
run: vendor/bin/phpunit
6+
test:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
fail-fast: true
10+
matrix:
11+
os: [ubuntu-latest, windows-latest]
12+
php: [8.0, 7.4]
13+
stability: [prefer-lowest, prefer-stable]
14+
15+
name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v2
20+
21+
- name: Setup PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: ${{ matrix.php }}
25+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
26+
coverage: none
27+
28+
- name: Setup problem matchers
29+
run: |
30+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
31+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
32+
- name: Install dependencies
33+
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction
34+
35+
- name: Execute tests
36+
run: vendor/bin/phpunit

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1+
.idea
2+
.php_cs
3+
.php_cs.cache
4+
.phpunit.result.cache
15
build
26
composer.lock
7+
coverage
38
docs
9+
phpunit.xml
10+
psalm.xml
411
vendor

.php_cs.dist

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
$finder = Symfony\Component\Finder\Finder::create()
4+
->in([
5+
__DIR__ . '/src',
6+
__DIR__ . '/tests',
7+
])
8+
->name('*.php')
9+
->notName('*.blade.php')
10+
->ignoreDotFiles(true)
11+
->ignoreVCS(true);
12+
13+
return PhpCsFixer\Config::create()
14+
->setRules([
15+
'@PSR2' => true,
16+
'array_syntax' => ['syntax' => 'short'],
17+
'ordered_imports' => ['sortAlgorithm' => 'alpha'],
18+
'no_unused_imports' => true,
19+
'not_operator_with_successor_space' => true,
20+
'trailing_comma_in_multiline_array' => true,
21+
'phpdoc_scalar' => true,
22+
'unary_operator_spaces' => true,
23+
'binary_operator_spaces' => true,
24+
'blank_line_before_statement' => [
25+
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
26+
],
27+
'phpdoc_single_line_var_spacing' => true,
28+
'phpdoc_var_without_name' => true,
29+
'class_attributes_separation' => [
30+
'elements' => [
31+
'method',
32+
],
33+
],
34+
'method_argument_space' => [
35+
'on_multiline' => 'ensure_fully_multiline',
36+
'keep_multiple_spaces_after_comma' => true,
37+
],
38+
'single_trait_insert_per_statement' => true,
39+
])
40+
->setFinder($finder);

.scrutinizer.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.styleci.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/phpunit-snapshot-assertions.svg?style=flat-square)](https://packagist.org/packages/spatie/phpunit-snapshot-assertions)
44
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
5-
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/spatie/phpunit-snapshot-assertions/run-tests?label=tests)](https://github.com/spatie/phpunit-snapshot-assertions/actions?query=workflow%3Arun-tests+branch%3Amaster)
6-
[![Quality Score](https://img.shields.io/scrutinizer/g/spatie/phpunit-snapshot-assertions.svg?style=flat-square)](https://scrutinizer-ci.com/g/spatie/phpunit-snapshot-assertions)
7-
[![StyleCI](https://styleci.io/repos/75926188/shield?branch=master)](https://styleci.io/repos/75926188)
5+
![run-tests](https://github.com/spatie/phpunit-snapshot-assertions/workflows/run-tests/badge.svg)
86
[![Total Downloads](https://img.shields.io/packagist/dt/spatie/phpunit-snapshot-assertions.svg?style=flat-square)](https://packagist.org/packages/spatie/phpunit-snapshot-assertions)
97

108
> Snapshot testing is a way to test without writing actual test cases
@@ -310,7 +308,7 @@ composer test
310308
311309
## Contributing
312310
313-
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
311+
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
314312
315313
## Security
316314

src/MatchesSnapshots.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515

1616
trait MatchesSnapshots
1717
{
18-
use SnapshotDirectoryAware, SnapshotIdAware;
18+
use SnapshotDirectoryAware;
19+
use SnapshotIdAware;
1920

2021
protected int $snapshotIncrementor = 0;
2122

tests/Integration/ComparesSnapshotFiles.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ protected function copyDirectory(string $sourcePath, string $destinationPath)
5959

6060
if (is_dir($sourcePath.'/'.$file)) {
6161
$this->copyDirectory($sourcePath.'/'.$file, $destinationPath.'/'.$file);
62+
6263
continue;
6364
}
6465

0 commit comments

Comments
 (0)