2017 © Pedro Peláez
 

library phpunit-dom-assertions

DOM assertions for PHPUnit

image

phpunit/phpunit-dom-assertions

DOM assertions for PHPUnit

  • Thursday, July 26, 2018
  • by lstrojny
  • Repository
  • 5 Watchers
  • 19 Stars
  • 73,009 Installations
  • PHP
  • 7 Dependents
  • 0 Suggesters
  • 11 Forks
  • 2 Open issues
  • 4 Versions
  • 12 % Grown

The README.md

PHPUnit DOM Assertions

Latest Stable Version Downloads Integrate, (*1)

A work in progress, drop-in replacement for the following deprecated PHPUnit assertions:, (*2)

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

Installation

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

Usage

Extend PHPUnit\Framework\DOMTestCase to use the DOM assertions:, (*3)

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., (*4)

The Versions

26/07 2018
06/02 2017
24/11 2016