Skip to content
This repository has been archived by the owner on Dec 7, 2018. It is now read-only.

Commit

Permalink
Merge pull request #95 from ptrofimov/feature/dataset_diff
Browse files Browse the repository at this point in the history
Table diff: fix for equal tables
  • Loading branch information
elazar committed May 31, 2013
2 parents 49269b6 + e9fbd3c commit ae7d79f
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions PHPUnit/Extensions/Database/DataSet/AbstractTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,25 +203,29 @@ public function __toString()
$values = array();

foreach ($columns as $columnName) {
try {
if ($this->getValue($i, $columnName) != $this->other->getValue($i, $columnName)) {
$values[] = sprintf(
'%s != actual %s',
var_export($this->getValue($i, $columnName), TRUE),
var_export($this->other->getValue($i, $columnName), TRUE)
);
} else {
$values[] = $this->getValue($i, $columnName);
if ($this->other) {
try {
if ($this->getValue($i, $columnName) != $this->other->getValue($i, $columnName)) {
$values[] = sprintf(
'%s != actual %s',
var_export($this->getValue($i, $columnName), TRUE),
var_export($this->other->getValue($i, $columnName), TRUE)
);
} else {
$values[] = $this->getValue($i, $columnName);
}
} catch (\InvalidArgumentException $ex) {
$values[] = $this->getValue($i, $columnName) . ': no row';
}
} catch (\InvalidArgumentException $ex) {
$values[] = $this->getValue($i, $columnName) . ': no row';
} else {
$values[] = $this->getValue($i, $columnName);
}
}

$tableString .= $this->rowToString($values) . $lineSeperator;
}

return "(table diff enabled) \n" . $tableString . "\n";
return ($this->other ? '(table diff enabled)' : '') . "\n" . $tableString . "\n";
}

protected function rowToString(Array $row)
Expand Down

0 comments on commit ae7d79f

Please sign in to comment.