Skip to content

Commit e2445a9

Browse files
Merge pull request #29 from stevegrunwell/release/v1.3.1
Version 1.3.1
2 parents 2f8890b + 6862733 commit e2445a9

File tree

9 files changed

+202
-116
lines changed

9 files changed

+202
-116
lines changed

.github/workflows/unit-tests.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Unit Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
run:
7+
runs-on: ${{ matrix.operating-system }}
8+
strategy:
9+
matrix:
10+
operating-system: [ubuntu-latest]
11+
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
12+
name: PHP ${{ matrix.php-versions }}
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v1
17+
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: ${{ matrix.php-versions }}
22+
coverage: none
23+
24+
- name: Get composer cache directory
25+
id: composer-cache
26+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
27+
28+
- name: Cache dependencies
29+
uses: actions/cache@v2
30+
with:
31+
path: ${{ steps.composer-cache.outputs.dir }}
32+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
33+
restore-keys: ${{ runner.os }}-composer-
34+
35+
- name: Install dependencies
36+
run: composer install --no-interaction --prefer-dist --no-suggest --no-progress
37+
38+
- name: Run test suite
39+
run: composer test

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
composer.lock
21
tests/coverage
32
vendor
3+
.phpunit.result.cache
4+
5+
# The composer.lock file is not needed, as this is a library whose dependencies
6+
# will depend on the version of PHP being used.
7+
composer.lock

.travis.yml

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

CHANGELOG.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,42 @@
11
# Changelog
2+
23
All notable changes to this project will be documented in this file.
34

45
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
56
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
67

8+
## [1.3.1] — 2020-01-14
9+
10+
* Fix PHPUnit warnings regarding `assertContains()` and `assertRegExp()`. Props [@jakobbuis](https://github.com/jakobbuis) ([#20], [#27], [#28])
11+
* Refactor the internal test scaffolding, including a move from Travis CI to GitHub Actions. Props [@peter279k](https://github.com/peter279k) for the assist with GitHub Actions ([#24])
12+
* Added PHP 8.0 support ([#26])
13+
714
## [1.3.0] — 2020-01-27
815

9-
* Replace `zendframework/zend-dom` with `laminas/laminas-dom` ([#16]).
10-
* Update Composer dependencies, add a `composer test` script ([#15]).
16+
* Replace `zendframework/zend-dom` with `laminas/laminas-dom` ([#16])
17+
* Update Composer dependencies, add a `composer test` script ([#15])
18+
1119

1220
## [1.2.0] - 2018-03-27
1321

1422
* Bumped the minimum version of zendframework/zend-dom to 2.7, which includes a fix for attribute values that include spaces ([#13]).
1523

24+
1625
## [1.1.0] - 2018-01-14
1726

18-
* Added the `assertElementContains()`, `assertElementNotContains()`, `assertElementRegExp()`, and `assertElementNotRegExp()` assertions, for verifying the contents of elements that match the given DOM query ([#6]).
19-
* Moved the `Tests` namespace into a development-only autoloader, to prevent them from potentially being included in projects using this library ([#7]).
20-
* [Based on this article by Martin Hujer](https://blog.martinhujer.cz/17-tips-for-using-composer-efficiently/#tip-%236%3A-put-%60composer.lock%60-into-%60.gitignore%60-in-libraries), remove the `composer.lock` file from the library ([#8]).
21-
* _Lower_ the minimum version of [zendframework/zend-dom](https://packagist.org/packages/zendframework/zend-dom) to 2.2.5 for maximum portability ([#9]).
27+
* Added the `assertElementContains()`, `assertElementNotContains()`, `assertElementRegExp()`, and `assertElementNotRegExp()` assertions, for verifying the contents of elements that match the given DOM query ([#6])
28+
* Moved the `Tests` namespace into a development-only autoloader, to prevent them from potentially being included in projects using this library ([#7])
29+
* [Based on this article by Martin Hujer](https://blog.martinhujer.cz/17-tips-for-using-composer-efficiently/#tip-%236%3A-put-%60composer.lock%60-into-%60.gitignore%60-in-libraries), remove the `composer.lock` file from the library ([#8])
30+
* _Lower_ the minimum version of [zendframework/zend-dom](https://packagist.org/packages/zendframework/zend-dom) to 2.2.5 for maximum portability ([#9])
31+
2232

2333
## [1.0.0] - 2017-10-24
2434

2535
* Initial release of the PHPUnit Markup Assertions Composer package.
2636

2737

2838
[Unreleased]: https://github.com/stevegrunwell/phpunit-markup-assertions/compare/master...develop
39+
[1.3.1]: https://github.com/stevegrunwell/phpunit-markup-assertions/releases/tag/v1.3.1
2940
[1.3.0]: https://github.com/stevegrunwell/phpunit-markup-assertions/releases/tag/v1.3.0
3041
[1.2.0]: https://github.com/stevegrunwell/phpunit-markup-assertions/releases/tag/v1.2.0
3142
[1.1.0]: https://github.com/stevegrunwell/phpunit-markup-assertions/releases/tag/v1.1.0
@@ -37,3 +48,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
3748
[#13]: https://github.com/stevegrunwell/phpunit-markup-assertions/issues/13
3849
[#15]: https://github.com/stevegrunwell/phpunit-markup-assertions/pull/15
3950
[#16]: https://github.com/stevegrunwell/phpunit-markup-assertions/issues/16
51+
[#20]: https://github.com/stevegrunwell/phpunit-markup-assertions/pull/20
52+
[#24]: https://github.com/stevegrunwell/phpunit-markup-assertions/pull/24
53+
[#26]: https://github.com/stevegrunwell/phpunit-markup-assertions/pull/26
54+
[#27]: https://github.com/stevegrunwell/phpunit-markup-assertions/pull/27
55+
[#28]: https://github.com/stevegrunwell/phpunit-markup-assertions/pull/28

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# PHPUnit Markup Assertions
22

3-
[![Build Status](https://travis-ci.org/stevegrunwell/phpunit-markup-assertions.svg?branch=develop)](https://travis-ci.org/stevegrunwell/phpunit-markup-assertions)
4-
[![Coverage Status](https://coveralls.io/repos/github/stevegrunwell/phpunit-markup-assertions/badge.svg?branch=develop)](https://coveralls.io/github/stevegrunwell/phpunit-markup-assertions?branch=develop)
3+
![Build Status](https://github.com/stevegrunwell/phpunit-markup-assertions/workflows/Unit%20Tests/badge.svg)
54
[![GitHub release](https://img.shields.io/github/release/stevegrunwell/phpunit-markup-assertions.svg)](https://github.com/stevegrunwell/phpunit-markup-assertions/releases)
65

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

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515
"source": "https://github.com/stevegrunwell/phpunit-markup-assertions/"
1616
},
1717
"require": {
18-
"laminas/laminas-dom": "^2.7"
18+
"php": "^5.6 || ^7.0 || ^8.0",
19+
"laminas/laminas-dom": "~2.7.2 || ^2.8"
1920
},
2021
"require-dev": {
21-
"phpunit/phpunit": "^6.0"
22+
"symfony/phpunit-bridge": "^5.2"
2223
},
2324
"autoload": {
2425
"psr-4": {
@@ -32,10 +33,10 @@
3233
},
3334
"scripts": {
3435
"test": [
35-
"phpunit"
36+
"simple-phpunit --testdox"
3637
],
3738
"test-coverage": [
38-
"phpunit --coverage-html=tests/coverage"
39+
"phpdbg -qrr -d memory_limit=-1 ./vendor/bin/simple-phpunit --coverage-html=tests/coverage --colors=always"
3940
]
4041
},
4142
"scripts-descriptions": {
@@ -44,7 +45,6 @@
4445
},
4546
"config": {
4647
"preferred-install": "dist",
47-
"sort-packages": true,
48-
"optimize-autoloader": true
48+
"sort-packages": true
4949
}
5050
}

src/MarkupAssertionsTrait.php

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,11 @@ public function assertNotHasElementWithAttributes($attributes = [], $output = ''
114114
*/
115115
public function assertElementContains($contents, $selector = '', $output = '', $message = '')
116116
{
117-
$this->assertContains(
117+
$method = method_exists($this, 'assertStringContainsString')
118+
? 'assertStringContainsString'
119+
: 'assertContains';
120+
121+
$this->$method(
118122
$contents,
119123
$this->getInnerHtmlOfMatchedElements($output, $selector),
120124
$message
@@ -133,7 +137,11 @@ public function assertElementContains($contents, $selector = '', $output = '', $
133137
*/
134138
public function assertElementNotContains($contents, $selector = '', $output = '', $message = '')
135139
{
136-
$this->assertNotContains(
140+
$method = method_exists($this, 'assertStringNotContainsString')
141+
? 'assertStringNotContainsString'
142+
: 'assertNotContains';
143+
144+
$this->$method(
137145
$contents,
138146
$this->getInnerHtmlOfMatchedElements($output, $selector),
139147
$message
@@ -152,7 +160,11 @@ public function assertElementNotContains($contents, $selector = '', $output = ''
152160
*/
153161
public function assertElementRegExp($regexp, $selector = '', $output = '', $message = '')
154162
{
155-
$this->assertRegExp(
163+
$method = method_exists($this, 'assertMatchesRegularExpression')
164+
? 'assertMatchesRegularExpression'
165+
: 'assertRegExp';
166+
167+
$this->$method(
156168
$regexp,
157169
$this->getInnerHtmlOfMatchedElements($output, $selector),
158170
$message
@@ -171,7 +183,11 @@ public function assertElementRegExp($regexp, $selector = '', $output = '', $mess
171183
*/
172184
public function assertElementNotRegExp($regexp, $selector = '', $output = '', $message = '')
173185
{
174-
$this->assertNotRegExp(
186+
$method = method_exists($this, 'assertDoesNotMatchRegularExpression')
187+
? 'assertDoesNotMatchRegularExpression'
188+
: 'assertNotRegExp';
189+
190+
$this->$method(
175191
$regexp,
176192
$this->getInnerHtmlOfMatchedElements($output, $selector),
177193
$message

0 commit comments

Comments
 (0)