https://github.com/lstrojny/phpunit-dom-assertions
A work in progress, drop-in replacement for PHPUnit's deprecated DOM assertions.
https://github.com/lstrojny/phpunit-dom-assertions
Last synced: 2 months ago
JSON representation
A work in progress, drop-in replacement for PHPUnit's deprecated DOM assertions.
- Host: GitHub
- URL: https://github.com/lstrojny/phpunit-dom-assertions
- Owner: lstrojny
- License: other
- Created: 2014-08-11T03:26:12.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2025-02-17T07:02:35.000Z (4 months ago)
- Last Synced: 2025-03-29T14:09:00.299Z (2 months ago)
- Language: PHP
- Size: 53.7 KB
- Stars: 29
- Watchers: 6
- Forks: 14
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHPUnit DOM Assertions
[](https://packagist.org/packages/phpunit/phpunit-dom-assertions)
[](https://packagist.org/packages/phpunit/phpunit-dom-assertions)
[](https://github.com/lstrojny/phpunit-dom-assertions/actions)A work in progress, drop-in replacement for the following deprecated PHPUnit assertions:
* `assertSelectCount()`
* `assertSelectRegExp()`
* `assertXPathCount()`
* `assertXPathEquals()`
* `assertXPathSelectRegExp()`
* `assertSelectEquals()`## Installation
```console
$ composer require --dev phpunit/phpunit-dom-assertions
```## Usage
Extend `PHPUnit\Framework\DOMTestCase` to use the DOM assertions:
```php
namespace My\Tests;use PHPUnit\Framework\DOMAssert;
use PHPUnit\Framework\TestCase;final class DOMTest extends TestCase
{
public function testSelectEquals(): void
{
$html = file_get_contents('test.html');
$selector = 'span.test_class';
$content = 'Test Class Text';DOMAssert::assertSelectEquals($selector, $content, true, $html);
}
}
```## License
The PHPUnit DOM assertions library is licensed under the [BSD 3-Clause license](LICENSE).