Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
9ebba8b
Add assertNotContainsSelector return type
szepeviktor Dec 29, 2022
d362631
Merge pull request #37 from szepeviktor/patch-1
stevegrunwell Dec 29, 2022
078d47e
Add PHP 8.3 to the GitHub Actions test matrix
stevegrunwell Nov 13, 2023
a003071
Merge pull request #39 from stevegrunwell/add-php83-to-test-matrix
stevegrunwell Nov 13, 2023
ce31aef
Move CONTRIBUTING.md into .github, exclude dev files from the package…
stevegrunwell Nov 14, 2023
590e375
Merge pull request #40 from stevegrunwell/remove-dev-files-from-archive
stevegrunwell Nov 14, 2023
24f212b
Replace laminas/dom with symfony/dom-crawler
stevegrunwell Nov 16, 2023
70103e4
Expand the @param tags for array arguments
stevegrunwell Nov 16, 2023
154d751
Change the visibility of the internal methods from protected to private
stevegrunwell Nov 16, 2023
c75b965
Merge pull request #41 from stevegrunwell/simplify-composer-constraints
stevegrunwell Dec 2, 2023
63c1d4d
Re-enable code coverage reporting to Coveralls
stevegrunwell Dec 2, 2023
195b8bb
Restore `composer test-coverage` using Xdebug
stevegrunwell Dec 2, 2023
8a3bfa0
Ignore the fallbacks for legacy PHPUnit methods when calculating code…
stevegrunwell Dec 2, 2023
30ee855
Fix inaccuracy in CONTRIBUTING docs re: running tests
stevegrunwell Dec 2, 2023
43c10c7
Merge pull request #43 from stevegrunwell/feature/restore-code-coverage
stevegrunwell Dec 2, 2023
b2839ff
Run code coverage when merging into develop and/or main
stevegrunwell Dec 2, 2023
452576e
Add a code coverage badge to the README file
stevegrunwell Dec 2, 2023
8feaae5
Merge pull request #44 from stevegrunwell/fix/code-coverage-on-develop
stevegrunwell Dec 2, 2023
e7559b6
Add PHP_CodeSniffer for checking coding standards
stevegrunwell Dec 3, 2023
3d17b2a
Merge pull request #45 from stevegrunwell/feature/phpcs
stevegrunwell Dec 3, 2023
2d3a414
Use squizlabs, not phpcsstandards/php_codesniffer
stevegrunwell Dec 11, 2023
d2d23d9
Merge pull request #47 from stevegrunwell/fix/phpcs-repo
stevegrunwell Dec 11, 2023
d45c330
Install Phan for static code analysis
stevegrunwell Dec 12, 2023
b8181b5
Remove PHPStan as a dev dependency when running PHPUnit
stevegrunwell Dec 12, 2023
1fa6e1d
Merge branch 'develop' into feature/static-code-analysis
stevegrunwell Dec 12, 2023
62cfbb1
Merge pull request #48 from stevegrunwell/feature/static-code-analysis
stevegrunwell Dec 12, 2023
9e2247e
Update symfony/phpunit-bridge requirement from ^5.2 || ^6.2 to ^5.2 |…
dependabot[bot] Dec 12, 2023
54761a6
Merge pull request #49 from stevegrunwell/dependabot/composer/symfony…
stevegrunwell Dec 15, 2023
13318e5
Remove PHP 5.x from composer.json, GitHub Actions
stevegrunwell Jul 10, 2025
fead459
Add return typehints, missing docblocks to the test class
stevegrunwell Jul 10, 2025
72daef6
Add PHP 8.4 to the unit test matrix
stevegrunwell Jul 10, 2025
e04ac94
Drop PHP 7.0 as well, since it doesn't support the void typehint
stevegrunwell Jul 10, 2025
169fb07
Ensure that PHPUnit exists before running PHPStan in GitHub Actions
stevegrunwell Jul 10, 2025
8d1e26f
Formatting, empty() check to satisfy PHP_CodeSniffer and PHPStan
stevegrunwell Jul 10, 2025
ae6596c
Merge pull request #52 from stevegrunwell/feature/drop-php-5x-support
stevegrunwell Jul 10, 2025
2c1e046
Permit the 7.x branches of symfony/css-selector, symfony/dom-crawler
stevegrunwell Jul 10, 2025
f038f0a
Require PHPStan 2.1 or newer
stevegrunwell Jul 10, 2025
919eb56
Ensure that PHPStan can see PHPUnit Bridge, fix broken docblock in te…
stevegrunwell Jul 10, 2025
0c957b3
Since we've effectively dropped PHPUnit 6.x and lower from the runnin…
stevegrunwell Jul 10, 2025
fd1be07
Fix an outdated comment in the PHP_CodeSniffer config
stevegrunwell Jul 10, 2025
c77a031
Explicit type casting to get us to PHPStan level 10! 🎉
stevegrunwell Jul 10, 2025
69cc9b2
Merge pull request #53 from stevegrunwell/update-dependencies
stevegrunwell Jul 10, 2025
fdca2a1
Indicate that tests/coverage may or may not exist
stevegrunwell Jul 10, 2025
f466be0
Merge pull request #54 from stevegrunwell/phpstan-2.x
stevegrunwell Jul 10, 2025
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
2 changes: 1 addition & 1 deletion CONTRIBUTING.md → .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ This project uses [the PSR-2 coding standards](http://www.php-fig.org/psr/psr-2/
[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:

```bash
$ ./vendor/bin/phpunit
$ composer test
```

#### Code coverage
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Code Coverage

on:
pull_request:
push:
branches:
- develop
- main

jobs:
coverage:
name: Report code coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: xdebug

- name: Install Composer dependencies
uses: ramsey/composer-install@v2

- name: Run test suite
run: vendor/bin/simple-phpunit --coverage-text --coverage-clover=tests/coverage

- name: Publish to Coveralls
uses: coverallsapp/github-action@v2
with:
files: tests/coverage
format: clover
fail-on-error: false
23 changes: 23 additions & 0 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Coding Standards

on: [pull_request]

jobs:
phpcs:
name: PHP_CodeSniffer
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: none

- name: Install Composer dependencies
uses: ramsey/composer-install@v2

- name: Run test suite
run: composer coding-standards
28 changes: 28 additions & 0 deletions .github/workflows/static-code-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Static Code Analysis

on: [pull_request]

jobs:
phpcs:
name: PHPStan
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: none

- name: Install Composer dependencies
uses: ramsey/composer-install@v2

# PHPUnit Bridge won't install a version of PHPUnit by default, but this will trick
# it into doing so.
- name: Install PHPUnit
run: composer test -- --version

- name: Run PHPStan
run: composer static-analysis
7 changes: 5 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,20 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
php-version: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none

- name: Remove PHPStan as a dependency
run: composer remove --dev phpstan/phpstan

- name: Install Composer dependencies
uses: ramsey/composer-install@v2

Expand Down
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
tests/coverage
vendor
*.DS_Store
.phpunit.result.cache
.vscode
phpcs.xml
phpstan.neon
phpunit.xml
tests/coverage
vendor

# The composer.lock file is not needed, as this is a library whose dependencies
# will depend on the version of PHP being used.
Expand Down
24 changes: 24 additions & 0 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<ruleset name="Custom ruleset">
<description>Coding standards for PHPUnit Markup Assertions</description>

<!-- Show progress and sniff codes in all reports -->
<arg value="ps"/>

<!-- Check all PHP files in directory tree by default. -->
<arg name="extensions" value="php"/>
<file>.</file>
<exclude-pattern>*/vendor/*</exclude-pattern>

<!-- Default to PSR-12 for coding standards-->
<rule ref="PSR12"/>

<!-- The tests/ directory may use snake_case for test methods -->
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
<exclude-pattern>tests/*</exclude-pattern>
</rule>

<!-- Ensure we're compatible with PHP 7.1+ -->
<rule ref="PHPCompatibility"/>
<config name="testVersion" value="7.1-"/>
</ruleset>
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# PHPUnit Markup Assertions

![Build Status](https://github.com/stevegrunwell/phpunit-markup-assertions/workflows/Unit%20Tests/badge.svg)
[![GitHub release](https://img.shields.io/github/release/stevegrunwell/phpunit-markup-assertions.svg)](https://github.com/stevegrunwell/phpunit-markup-assertions/releases)
[![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)
[![GitHub Release](https://img.shields.io/github/release/stevegrunwell/phpunit-markup-assertions.svg)](https://github.com/stevegrunwell/phpunit-markup-assertions/releases)

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

Expand Down
34 changes: 29 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@
"source": "https://github.com/stevegrunwell/phpunit-markup-assertions/"
},
"require": {
"php": "^5.6 || ^7.0 || ^8.0",
"laminas/laminas-dom": "~2.7.2 || ^2.8"
"php": "^7.1 || ^8.0",
"symfony/css-selector": "^4.4|^5.4|^6.0|^7.0",
"symfony/dom-crawler": "^4.4|^5.4|^6.0|^7.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^5.2 || ^6.2"
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"phpcompatibility/php-compatibility": "^9.3",
"phpstan/phpstan": "^2.1",
"squizlabs/php_codesniffer": "^3.7",
"symfony/phpunit-bridge": "^5.2 || ^6.2 || ^7.0"
},
"autoload": {
"psr-4": {
Expand All @@ -32,19 +37,38 @@
}
},
"scripts": {
"coding-standards": [
"phpcs"
],
"static-analysis": [
"phpstan analyse"
],
"test": [
"simple-phpunit --testdox"
],
"test-coverage": [
"phpdbg -qrr -d memory_limit=-1 ./vendor/bin/simple-phpunit --coverage-html=tests/coverage --colors=always"
"XDEBUG_MODE=coverage ./vendor/bin/simple-phpunit --coverage-html=tests/coverage --colors=always"
]
},
"scripts-descriptions": {
"coding-standards": "Check coding standards.",
"static-analysis": "Run static code analysis",
"test": "Run all test suites.",
"test-coverage": "Generate code coverage reports in tests/coverage."
},
"config": {
"preferred-install": "dist",
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"archive": {
"exclude": [
"_config.yml",
".*",
"phpunit.*",
"tests"
]
}
}
15 changes: 15 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
parameters:
level: 10

# Code to be analyzed
paths:
- src
- tests

# Don't worry about the coverage reports
excludePaths:
- tests/coverage (?)

# PHPUnit Bridge puts the PHPUnit source in an unconventional location
scanDirectories:
- vendor/bin/.phpunit/phpunit
Loading