/** * A private method to perform assertions on the contents of the * log_maintenance_priority table. * * @access private * @param integer $id Optional row ID to test on, if not set, tests * that table is empty. * @param PEAR::Date $oBeforeUpdateDate The before date to test the row with. * @param PEAR::Date $oAfterUpdateDate The after date to test the row with. * @param integer $oi The operation interval to test the row with. * @param integer $runType The run type value to test the row with. * @param string $updatedTo The updated to date to test the row with, if any. */ function _assertLogMaintenance($id = null, $oBeforeUpdateDate = null, $oAfterUpdateDate = null, $oi = null, $runType = null, $updatedTo = null) { $aConf = $GLOBALS['_MAX']['CONF']; $tableName = $aConf['table']['prefix'] . 'log_maintenance_priority'; $table = $this->oDbh->quoteIdentifier($tableName, true); $query = "\n SELECT\n start_run,\n end_run,\n operation_interval,\n run_type,\n updated_to\n FROM\n {$table}"; if (!is_null($id)) { $query .= "\n WHERE\n log_maintenance_priority_id = {$id}"; } $rc = $this->oDbh->query($query); $aRow = $rc->fetchRow(); if (is_null($id)) { // Check there are no rows returned $this->assertNull($aRow); } else { // Check the returned row's values $oStartRunDate = new Date($aRow['start_run']); $oEndRunDate = new Date($aRow['end_run']); $result = $oBeforeUpdateDate->before($oStartRunDate); $this->assertTrue($result); $result = $oBeforeUpdateDate->before($oEndRunDate); $this->assertTrue($result); $result = $oAfterUpdateDate->after($oStartRunDate); $this->assertTrue($result); $result = $oAfterUpdateDate->after($oEndRunDate); $this->assertTrue($result); $result = $oStartRunDate->after($oEndRunDate); $this->assertFalse($result); $this->assertEqual($aRow['operation_interval'], $oi); $this->assertEqual($aRow['run_type'], $runType); if (!is_null($updatedTo)) { $this->assertEqual($aRow['updated_to'], $updatedTo); } else { $this->assertNull($aRow['updated_to']); } } }