PHP code example of spiderling-php / phpunit-matches-selector

1. Go to this page and download the library: Download spiderling-php/phpunit-matches-selector library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

spiderling-php / phpunit-matches-selector example snippets



use SP\PhpunitDomConstraints\DomConstraintsTrait;
use PHPUnit_Framework_TestCase;

class TestCaseTest extends PHPUnit_Framework_TestCase
{
    use DomConstraintsTrait;

    public function testTest()
    {
        $document = new DOMDocument();
        $document->load('Some file');

        $element = $document->getElementById('some id');

        // Here is the test you can now perform
        $this->assertMatchesSelector('div.some-class', $element, 'This should match');

        // You can do even more complex selects
        $this->assertMatchesSelector('ul li > #test.some-class[disabled]', $element, 'This should match');
    }
}