tiny / xml-assertions
There is no license information available for the latest version (v0.1.0) of this package.
Xml assertions for PHPUnit.
v0.1.0
2018-11-16 15:35 UTC
Requires (Dev)
- phpunit/phpunit: ^5.7
This package is auto-updated.
Last update: 2024-09-11 14:47:04 UTC
README
This package provides XML assertions.
Install
$ composer require --dev tiny/xml-assertions
Usage
Use \Tiny\Testing\Assertions\Xml\XmlAssertionsTrait
in test case.
Available assertions:
/** * Assert that xpath exists. * @param string $xpath Xpath to search * @param mixed $domNode DOMDocument or DOMElement instance as a start for search * @param integer $count How many times xpath is expected to be found. Null if any. * @param string $message Message to be displayed by PHPUnit on failure. */ public static function assertXpathExists($xpath, $domNode, $count = null, $message = ''); /** * * @param string $xpath Xpath where value is expected to be found * @param mixed $value Expected value * @param mixed $domNode DOMDocument or DOMElement instance as a start for search * @param string $message Message to be displayed by PHPUnit on failure. */ public static function assertValueOnXpath($xpath, $value, $domNode, $message = '');
Demo
Sample output for failures can be seen in the sample file. The file contains output for demo test suite. If needed, the suite can be run via:
$ composer run-script demo