I'm using PHPUnit to check insertion of objects via my storage object. Each domain object includes a added and lastmodified timestamp, that's handled through the storage object instantly. I'm able to using PHPUnits DB extensions method assertDataSetsEqual and passing as XML data set as below shows. The issue is added and lastmodified can't be hardcoded in to the XML dataset because this can change constantly instantly, can one tell PHPUnit to disregard these cols? or compare the tables output one other way (not XML) where I'm able to ignore these posts?


$user = new Social_User();

$store = new Storage();

$xml_dataset = $this->createFlatXMLDataSet('after-new.xml');
$this->assertDataSetsEqual($xml_dataset, $this->getConnection()->createDataSet());

XML Dataset

<?xml version="1.0" encoding="UTF-8"?>
            <user id="1" password="NULL" ip="0" added="0" authenticated="0" lat="0" lon="0" avatar="0" fk_mswuserId="1" timezoneoffset="0" firstName="Ben" lastName="Freeston" deleted="0" lastModified="0" />
            <user id="2" password="NULL" ip="0" added="0" authenticated="0" lat="0" lon="0" avatar="0" fk_mswuserId="10" timezoneoffset="0" firstName="Gavin" lastName="Cooper" deleted="0" lastModified="0"/>

Based on

this really is already built-in.

Also see these 35mm slides by M.Lively (the primary DBUnit author)

and B. Eberlei's Ultimate Help guide to DB Testing with PHPUnit

Therefore it should work like

$database_dataset = new PHPUnit_Extensions_Database_DataSet_DataSetFilter ( 
    array('bank_account' => array ('date_created')) // excluded