Skip to content

Commit 1c6b4a7

Browse files
Merge pull request #55 from stevegrunwell/release/v2.0.0
Version 2.0.0
2 parents 525823c + f466be0 commit 1c6b4a7

12 files changed

+237
-72
lines changed

CONTRIBUTING.md renamed to .github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ This project uses [the PSR-2 coding standards](http://www.php-fig.org/psr/psr-2/
4444
[PHPUnit](https://phpunit.de/) is included as a development dependency, and should be run regularly. When submitting changes, please be sure to add or update unit tests accordingly. You may run unit tests at any time by running:
4545

4646
```bash
47-
$ ./vendor/bin/phpunit
47+
$ composer test
4848
```
4949

5050
#### Code coverage

.github/workflows/code-coverage.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Code Coverage
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- develop
8+
- main
9+
10+
jobs:
11+
coverage:
12+
name: Report code coverage
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: '8.2'
22+
coverage: xdebug
23+
24+
- name: Install Composer dependencies
25+
uses: ramsey/composer-install@v2
26+
27+
- name: Run test suite
28+
run: vendor/bin/simple-phpunit --coverage-text --coverage-clover=tests/coverage
29+
30+
- name: Publish to Coveralls
31+
uses: coverallsapp/github-action@v2
32+
with:
33+
files: tests/coverage
34+
format: clover
35+
fail-on-error: false
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Coding Standards
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
phpcs:
7+
name: PHP_CodeSniffer
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
13+
- name: Setup PHP
14+
uses: shivammathur/setup-php@v2
15+
with:
16+
php-version: '8.2'
17+
coverage: none
18+
19+
- name: Install Composer dependencies
20+
uses: ramsey/composer-install@v2
21+
22+
- name: Run test suite
23+
run: composer coding-standards
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Static Code Analysis
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
phpcs:
7+
name: PHPStan
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
13+
- name: Setup PHP
14+
uses: shivammathur/setup-php@v2
15+
with:
16+
php-version: '8.2'
17+
coverage: none
18+
19+
- name: Install Composer dependencies
20+
uses: ramsey/composer-install@v2
21+
22+
# PHPUnit Bridge won't install a version of PHPUnit by default, but this will trick
23+
# it into doing so.
24+
- name: Install PHPUnit
25+
run: composer test -- --version
26+
27+
- name: Run PHPStan
28+
run: composer static-analysis

.github/workflows/unit-tests.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,20 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
php-version: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
11+
php-version: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v2
14+
uses: actions/checkout@v4
1515

1616
- name: Setup PHP
1717
uses: shivammathur/setup-php@v2
1818
with:
1919
php-version: ${{ matrix.php-version }}
2020
coverage: none
2121

22+
- name: Remove PHPStan as a dependency
23+
run: composer remove --dev phpstan/phpstan
24+
2225
- name: Install Composer dependencies
2326
uses: ramsey/composer-install@v2
2427

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
tests/coverage
2-
vendor
1+
*.DS_Store
32
.phpunit.result.cache
43
.vscode
4+
phpcs.xml
5+
phpstan.neon
6+
phpunit.xml
7+
tests/coverage
8+
vendor
59

610
# The composer.lock file is not needed, as this is a library whose dependencies
711
# will depend on the version of PHP being used.

.phpcs.xml.dist

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Custom ruleset">
3+
<description>Coding standards for PHPUnit Markup Assertions</description>
4+
5+
<!-- Show progress and sniff codes in all reports -->
6+
<arg value="ps"/>
7+
8+
<!-- Check all PHP files in directory tree by default. -->
9+
<arg name="extensions" value="php"/>
10+
<file>.</file>
11+
<exclude-pattern>*/vendor/*</exclude-pattern>
12+
13+
<!-- Default to PSR-12 for coding standards-->
14+
<rule ref="PSR12"/>
15+
16+
<!-- The tests/ directory may use snake_case for test methods -->
17+
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
18+
<exclude-pattern>tests/*</exclude-pattern>
19+
</rule>
20+
21+
<!-- Ensure we're compatible with PHP 7.1+ -->
22+
<rule ref="PHPCompatibility"/>
23+
<config name="testVersion" value="7.1-"/>
24+
</ruleset>

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# PHPUnit Markup Assertions
22

33
![Build Status](https://github.com/stevegrunwell/phpunit-markup-assertions/workflows/Unit%20Tests/badge.svg)
4-
[![GitHub release](https://img.shields.io/github/release/stevegrunwell/phpunit-markup-assertions.svg)](https://github.com/stevegrunwell/phpunit-markup-assertions/releases)
4+
[![Code Coverage](https://coveralls.io/repos/github/stevegrunwell/phpunit-markup-assertions/badge.svg?branch=develop)](https://coveralls.io/github/stevegrunwell/phpunit-markup-assertions?branch=develop)
5+
[![GitHub Release](https://img.shields.io/github/release/stevegrunwell/phpunit-markup-assertions.svg)](https://github.com/stevegrunwell/phpunit-markup-assertions/releases)
56

67
This library introduces the `MarkupAssertionsTrait` trait for use in [PHPUnit](https://phpunit.de) tests.
78

composer.json

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,16 @@
1515
"source": "https://github.com/stevegrunwell/phpunit-markup-assertions/"
1616
},
1717
"require": {
18-
"php": "^5.6 || ^7.0 || ^8.0",
19-
"laminas/laminas-dom": "~2.7.2 || ^2.8"
18+
"php": "^7.1 || ^8.0",
19+
"symfony/css-selector": "^4.4|^5.4|^6.0|^7.0",
20+
"symfony/dom-crawler": "^4.4|^5.4|^6.0|^7.0"
2021
},
2122
"require-dev": {
22-
"symfony/phpunit-bridge": "^5.2 || ^6.2"
23+
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
24+
"phpcompatibility/php-compatibility": "^9.3",
25+
"phpstan/phpstan": "^2.1",
26+
"squizlabs/php_codesniffer": "^3.7",
27+
"symfony/phpunit-bridge": "^5.2 || ^6.2 || ^7.0"
2328
},
2429
"autoload": {
2530
"psr-4": {
@@ -32,19 +37,38 @@
3237
}
3338
},
3439
"scripts": {
40+
"coding-standards": [
41+
"phpcs"
42+
],
43+
"static-analysis": [
44+
"phpstan analyse"
45+
],
3546
"test": [
3647
"simple-phpunit --testdox"
3748
],
3849
"test-coverage": [
39-
"phpdbg -qrr -d memory_limit=-1 ./vendor/bin/simple-phpunit --coverage-html=tests/coverage --colors=always"
50+
"XDEBUG_MODE=coverage ./vendor/bin/simple-phpunit --coverage-html=tests/coverage --colors=always"
4051
]
4152
},
4253
"scripts-descriptions": {
54+
"coding-standards": "Check coding standards.",
55+
"static-analysis": "Run static code analysis",
4356
"test": "Run all test suites.",
4457
"test-coverage": "Generate code coverage reports in tests/coverage."
4558
},
4659
"config": {
4760
"preferred-install": "dist",
48-
"sort-packages": true
61+
"sort-packages": true,
62+
"allow-plugins": {
63+
"dealerdirect/phpcodesniffer-composer-installer": true
64+
}
65+
},
66+
"archive": {
67+
"exclude": [
68+
"_config.yml",
69+
".*",
70+
"phpunit.*",
71+
"tests"
72+
]
4973
}
5074
}

phpstan.neon.dist

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
parameters:
2+
level: 10
3+
4+
# Code to be analyzed
5+
paths:
6+
- src
7+
- tests
8+
9+
# Don't worry about the coverage reports
10+
excludePaths:
11+
- tests/coverage (?)
12+
13+
# PHPUnit Bridge puts the PHPUnit source in an unconventional location
14+
scanDirectories:
15+
- vendor/bin/.phpunit/phpunit

0 commit comments

Comments
 (0)