php/dbunit 错误,当我在表中为空时我得到并在测试包含或返回 NULL 值的存储过程或查询时出错,我尝试了相同的示例,它不返回任何 NULL 值并且它工作完美,我如何表示XML文件中的NULL来测试它
测试代码
public function StarRead()
{
fwrite(STDOUT, __METHOD__ . " Check with valid data \n");
$resultTable = $this->getConnection()->createQueryTable(
'Star', 'CALL get_star(1,NULL,0,2)'
);
$expected = $this->createFlatXMLDataSet(dirname(__FILE__).'/_files/new.xml');
$expectedTable = $expected->getTable('Star');
//Here we check that the table in the database matches the data in the XML file
$this->assertTablesEqual($expectedTable, $resultTable);
}
文件
<?xml version="1.0" encoding="UTF-8"?>
<dataset>
<Star
productId ="4"
currentPrice =""
listPrice =""
createdOn ="2012-12-12 12:12:12"
originalImage ="link"
merchantName =""
title ="Christopher Knight H"
url ="link"
/>
</dataset>
输出:
PHPUnit 4.0.12 by Sebastian Bergmann.
DBTest::StarRead Check with valid data F
Time: 1.4 seconds, Memory: 8.50Mb
There was 1 failure:
1) DBTest::StarRead Failed asserting that +----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+ | AutoStar | +----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+ | productId | currentPrice | listPrice | createdOn | originalImage | merchantName | title | url | +----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+ | 4 | NULL | NULL | 2012-12-12 12:12:12 | link | NULL | Christopher Knight H | link | +----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+
is equal to expected (table diff enabled) +----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+ | AutoStar | +----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+ | productId | currentPrice | listPrice | createdOn | originalImage | merchantName | title | url | +----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+ | 4 | | | 2012-12-12 12:12:12 | link | | Christopher Knight H | link | +----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+----------------------+
.
FAILURES! Tests: 1, Assertions: 1, Failures: 1.
我在 Ubuntu 12.04 LTS (phpunit 3.7.28) 中尝试了相同的代码,它工作正常。
在 Debian 6.0.8 (phpunit 4.0.12) 中,它给了我同样的错误。为什么是这样?