Coder Social home page Coder Social logo

phanan-forks / phpunit-dom-assertions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lstrojny/phpunit-dom-assertions

0.0 1.0 0.0 22 KB

A work in progress, drop-in replacement for PHPUnit's deprecated DOM assertions.

License: Other

PHP 96.81% HTML 3.19%

phpunit-dom-assertions's Introduction

PHPUnit DOM Assertions

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

  • assertSelectCount()
  • assertSelectRegExp()
  • assertSelectEquals()
  • assertTag() (not yet ported)
  • assertNotTag() (not yet ported)

TODO

  • Port assertTag() and assertNotTag().
  • Improve tests.
  • Improve error messages.
  • Improve comments and documentation.
  • Add XPath support.

Requirements

The PHPUnit DOM assertions require PHP 7.0 or later.

Installation

The recommended way to install the PHPUnit DOM assertions is through composer. Just create a composer.json file and run the php composer.phar install command to install it:

{
    "require-dev": {
        "phpunit/phpunit-dom-assertions": "~2"
    }
}

Usage

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

namespace My\Tests;

use PHPUnit\Framework\DOMTestCase;

class DOMTest extends DOMTestCase
{
    public function testSelectEquals()
    {
        $html = file_get_contents('test.html');
        $selector = 'span.test_class';
        $content  = 'Test Class Text';

        $this->assertSelectEquals($selector, $content, true, $html);
    }
}

Tests

Build Status

To run the test suite, you need composer.

$ php composer.phar install
$ vendor/bin/phpunit

License

The PHPUnit DOM assertions library is licensed under the BSD 3-Clause license.

phpunit-dom-assertions's People

Contributors

lstrojny avatar whatthejeff avatar borro avatar dawehner avatar henriquemoody avatar charliemcr avatar jeroendedauw avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.