phpunit/phpunit-dom-assertions

DOM assertions for PHPUnit

Maintainers

👁 lstrojny

Package info

github.com/lstrojny/phpunit-dom-assertions

pkg:composer/phpunit/phpunit-dom-assertions

Statistics

Installs: 371 735

Dependents: 14

Suggesters: 0

Stars: 29

Open Issues: 1

v3.8.0 2026-02-12 08:43 UTC

Requires

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT ff5058ff697dfdb3622f6bcf3c3f052081481587

  • Sebastian Bergmann <sebastian.woop@phpunit.de>
  • Jeff Welch <whatthejeff.woop@gmail.com>
  • Lars Strojny <lars.woop@strojny.net>

phpunitcssdomXpathtestsassertions

This package is auto-updated.

Last update: 2026-06-12 09:28:38 UTC


README

👁 Latest Stable Version
👁 Downloads
👁 Integrate

A work in progress, drop-in replacement for the following deprecated PHPUnit assertions:

  • assertSelectCount()
  • assertSelectRegExp()
  • assertXPathCount()
  • assertXPathEquals()
  • assertXPathSelectRegExp()
  • assertSelectEquals()

Installation

$ composer require --dev phpunit/phpunit-dom-assertions

Usage

Extend PHPUnit\Framework\DOMTestCase to use the DOM assertions:

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.