tiny / xml-assertions

此包的最新版本(v0.1.0)没有可用的许可信息。

PHPUnit的XML断言。

v0.1.0 2018-11-16 15:35 UTC

This package is auto-updated.

Last update: 2024-09-11 14:47:04 UTC


README

此包提供XML断言。

安装

$ composer require --dev tiny/xml-assertions

用法

在测试用例中使用\Tiny\Testing\Assertions\Xml\XmlAssertionsTrait

可用的断言

/**
 * 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 = '');

示例

失败的样本输出可以在样本文件中看到。文件包含演示测试套件的输出。如果需要,可以通过以下方式运行套件:

$ composer run-script demo