Skip to content

Commit

Permalink
Merge pull request #29 from stevegrunwell/release/v1.3.1
Browse files Browse the repository at this point in the history
Version 1.3.1
  • Loading branch information
stevegrunwell authored Jan 14, 2021
2 parents 2f8890b + 6862733 commit e2445a9
Show file tree
Hide file tree
Showing 9 changed files with 202 additions and 116 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Unit Tests

on: [push, pull_request]

jobs:
run:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
name: PHP ${{ matrix.php-versions }}

steps:
- name: Checkout
uses: actions/checkout@v1

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

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --no-interaction --prefer-dist --no-suggest --no-progress

- name: Run test suite
run: composer test
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
composer.lock
tests/coverage
vendor
.phpunit.result.cache

# The composer.lock file is not needed, as this is a library whose dependencies
# will depend on the version of PHP being used.
composer.lock
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

28 changes: 22 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,42 @@
# Changelog

All notable changes to this project will be documented in this file.

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

## [1.3.1] — 2020-01-14

* Fix PHPUnit warnings regarding `assertContains()` and `assertRegExp()`. Props [@jakobbuis](https://github.com/jakobbuis) ([#20], [#27], [#28])
* 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])
* Added PHP 8.0 support ([#26])

## [1.3.0] — 2020-01-27

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


## [1.2.0] - 2018-03-27

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


## [1.1.0] - 2018-01-14

* Added the `assertElementContains()`, `assertElementNotContains()`, `assertElementRegExp()`, and `assertElementNotRegExp()` assertions, for verifying the contents of elements that match the given DOM query ([#6]).
* Moved the `Tests` namespace into a development-only autoloader, to prevent them from potentially being included in projects using this library ([#7]).
* [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]).
* _Lower_ the minimum version of [zendframework/zend-dom](https://packagist.org/packages/zendframework/zend-dom) to 2.2.5 for maximum portability ([#9]).
* Added the `assertElementContains()`, `assertElementNotContains()`, `assertElementRegExp()`, and `assertElementNotRegExp()` assertions, for verifying the contents of elements that match the given DOM query ([#6])
* Moved the `Tests` namespace into a development-only autoloader, to prevent them from potentially being included in projects using this library ([#7])
* [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])
* _Lower_ the minimum version of [zendframework/zend-dom](https://packagist.org/packages/zendframework/zend-dom) to 2.2.5 for maximum portability ([#9])


## [1.0.0] - 2017-10-24

* Initial release of the PHPUnit Markup Assertions Composer package.


[Unreleased]: https://github.com/stevegrunwell/phpunit-markup-assertions/compare/master...develop
[1.3.1]: https://github.com/stevegrunwell/phpunit-markup-assertions/releases/tag/v1.3.1
[1.3.0]: https://github.com/stevegrunwell/phpunit-markup-assertions/releases/tag/v1.3.0
[1.2.0]: https://github.com/stevegrunwell/phpunit-markup-assertions/releases/tag/v1.2.0
[1.1.0]: https://github.com/stevegrunwell/phpunit-markup-assertions/releases/tag/v1.1.0
Expand All @@ -37,3 +48,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
[#13]: https://github.com/stevegrunwell/phpunit-markup-assertions/issues/13
[#15]: https://github.com/stevegrunwell/phpunit-markup-assertions/pull/15
[#16]: https://github.com/stevegrunwell/phpunit-markup-assertions/issues/16
[#20]: https://github.com/stevegrunwell/phpunit-markup-assertions/pull/20
[#24]: https://github.com/stevegrunwell/phpunit-markup-assertions/pull/24
[#26]: https://github.com/stevegrunwell/phpunit-markup-assertions/pull/26
[#27]: https://github.com/stevegrunwell/phpunit-markup-assertions/pull/27
[#28]: https://github.com/stevegrunwell/phpunit-markup-assertions/pull/28
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# PHPUnit Markup Assertions

[![Build Status](https://travis-ci.org/stevegrunwell/phpunit-markup-assertions.svg?branch=develop)](https://travis-ci.org/stevegrunwell/phpunit-markup-assertions)
[![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)
![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)

This library introduces the `MarkupAssertionsTrait` trait for use in [PHPUnit](https://phpunit.de) tests.
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
"source": "https://github.com/stevegrunwell/phpunit-markup-assertions/"
},
"require": {
"laminas/laminas-dom": "^2.7"
"php": "^5.6 || ^7.0 || ^8.0",
"laminas/laminas-dom": "~2.7.2 || ^2.8"
},
"require-dev": {
"phpunit/phpunit": "^6.0"
"symfony/phpunit-bridge": "^5.2"
},
"autoload": {
"psr-4": {
Expand All @@ -32,10 +33,10 @@
},
"scripts": {
"test": [
"phpunit"
"simple-phpunit --testdox"
],
"test-coverage": [
"phpunit --coverage-html=tests/coverage"
"phpdbg -qrr -d memory_limit=-1 ./vendor/bin/simple-phpunit --coverage-html=tests/coverage --colors=always"
]
},
"scripts-descriptions": {
Expand All @@ -44,7 +45,6 @@
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
"sort-packages": true
}
}
24 changes: 20 additions & 4 deletions src/MarkupAssertionsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ public function assertNotHasElementWithAttributes($attributes = [], $output = ''
*/
public function assertElementContains($contents, $selector = '', $output = '', $message = '')
{
$this->assertContains(
$method = method_exists($this, 'assertStringContainsString')
? 'assertStringContainsString'
: 'assertContains';

$this->$method(
$contents,
$this->getInnerHtmlOfMatchedElements($output, $selector),
$message
Expand All @@ -133,7 +137,11 @@ public function assertElementContains($contents, $selector = '', $output = '', $
*/
public function assertElementNotContains($contents, $selector = '', $output = '', $message = '')
{
$this->assertNotContains(
$method = method_exists($this, 'assertStringNotContainsString')
? 'assertStringNotContainsString'
: 'assertNotContains';

$this->$method(
$contents,
$this->getInnerHtmlOfMatchedElements($output, $selector),
$message
Expand All @@ -152,7 +160,11 @@ public function assertElementNotContains($contents, $selector = '', $output = ''
*/
public function assertElementRegExp($regexp, $selector = '', $output = '', $message = '')
{
$this->assertRegExp(
$method = method_exists($this, 'assertMatchesRegularExpression')
? 'assertMatchesRegularExpression'
: 'assertRegExp';

$this->$method(
$regexp,
$this->getInnerHtmlOfMatchedElements($output, $selector),
$message
Expand All @@ -171,7 +183,11 @@ public function assertElementRegExp($regexp, $selector = '', $output = '', $mess
*/
public function assertElementNotRegExp($regexp, $selector = '', $output = '', $message = '')
{
$this->assertNotRegExp(
$method = method_exists($this, 'assertDoesNotMatchRegularExpression')
? 'assertDoesNotMatchRegularExpression'
: 'assertNotRegExp';

$this->$method(
$regexp,
$this->getInnerHtmlOfMatchedElements($output, $selector),
$message
Expand Down
Loading

0 comments on commit e2445a9

Please sign in to comment.