Skip to content

Commit 397bcbe

Browse files
Move PHPUnit_Framework_TestCase::dataToString() to Exporter::shortenedRecursiveExport()
1 parent 86efc79 commit 397bcbe

File tree

2 files changed

+4
-43
lines changed

2 files changed

+4
-43
lines changed

composer.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
"sebastian/comparator": "~1.1",
3434
"sebastian/diff": "~1.1",
3535
"sebastian/environment": "~1.2",
36-
"sebastian/exporter": "~1.1",
37-
"sebastian/recursion-context": "~1.0",
36+
"sebastian/exporter": "~1.2",
3837
"sebastian/global-state": "~1.0",
3938
"sebastian/version": "~1.0",
4039
"ext-dom": "*",

src/Framework/TestCase.php

+3-41
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use SebastianBergmann\GlobalState\Snapshot;
1212
use SebastianBergmann\GlobalState\Restorer;
1313
use SebastianBergmann\GlobalState\Blacklist;
14-
use SebastianBergmann\RecursionContext\Context;
1514
use SebastianBergmann\Exporter\Exporter;
1615
use Prophecy\Exception\Prediction\PredictionException;
1716
use Prophecy\Prophet;
@@ -1665,45 +1664,6 @@ public static function onConsecutiveCalls()
16651664
return new PHPUnit_Framework_MockObject_Stub_ConsecutiveCalls($args);
16661665
}
16671666

1668-
/**
1669-
* @param mixed $data The data to export as a string
1670-
* @param SebastianBergmann\RecursionContext\Context $processed Contains all objects and arrays that have previously been processed
1671-
* @return string
1672-
* @since Method available since Release 3.2.1
1673-
*/
1674-
protected function dataToString(&$data, $processed = null)
1675-
{
1676-
$result = array();
1677-
$exporter = new Exporter();
1678-
1679-
if (!$processed) {
1680-
$processed = new Context;
1681-
}
1682-
1683-
$processed->add($data);
1684-
1685-
foreach ($data as $key => $value) {
1686-
if (is_array($value)) {
1687-
if ($processed->contains($data[$key]) !== false) {
1688-
$result[] = '*RECURSION*';
1689-
}
1690-
1691-
else {
1692-
$result[] = sprintf(
1693-
'array(%s)',
1694-
$this->dataToString($data[$key], $processed)
1695-
);
1696-
}
1697-
}
1698-
1699-
else {
1700-
$result[] = $exporter->shortenedExport($value);
1701-
}
1702-
}
1703-
1704-
return join(', ', $result);
1705-
}
1706-
17071667
/**
17081668
* Gets the data set description of a TestCase.
17091669
*
@@ -1722,8 +1682,10 @@ protected function getDataSetAsString($includeData = true)
17221682
$buffer .= sprintf(' with data set "%s"', $this->dataName);
17231683
}
17241684

1685+
$exporter = new Exporter;
1686+
17251687
if ($includeData) {
1726-
$buffer .= sprintf(' (%s)', $this->dataToString($this->data));
1688+
$buffer .= sprintf(' (%s)', $exporter->shortenedRecursiveExport($this->data));
17271689
}
17281690
}
17291691

0 commit comments

Comments
 (0)