I'm new to database testing with PhpUnit. I'm starting with simple test that compare PostgreSQL table's content with xml file.
The problem is that assertion doesn't work as expected:
Please take a look of the result:
http://www3.picturepush.com/photo/a/5540556/1024/Anonymous/Screenshot.png
As you see the tables are equal, but the content in db table(first at screen) has an extra spaces...
I've no idea what is wrong.
Here is PHP code:
public function testGetSourceData()
{
include_once(
sfConfig::get('sf_lib_dir')
. '/task/ShopCategoryTreeUpdateTask.class.php'
);
$method = new ReflectionMethod(
'ShopCategoryTreeUpdateTask', '_getSourceData'
);
$method->setAccessible(TRUE);
$res = $method->invoke(new ShopCategoryTreeUpdateTask(new sfEventDispatcher, new sfFormatter),123);
$actual = new PHPUnit_Extensions_Database_DataSet_QueryDataSet($this->getConnection());
$actual->addTable('shop');
$expected = $this->getDataSet();
$this->assertDataSetsEqual(
$actual,
$expected
);
}
and here the XML: http://pastebin.com/5MmtJDr6
Thanks for any goals!