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

Table diff: fix for equal tables #95

Merged
merged 1 commit into from
May 31, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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