Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions lib/debug/sfDebug.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ public static function removeObjects($values)
*/
public static function shortenFilePath($file)
{
if (!$file) {
return $file;
}

foreach (array('sf_root_dir', 'sf_symfony_lib_dir') as $key) {
if (0 === strpos($file, $value = sfConfig::get($key))) {
$file = str_replace($value, strtoupper($key), $file);
Expand Down
5 changes: 4 additions & 1 deletion test/unit/debug/sfDebugTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@

require_once __DIR__.'/../../bootstrap/unit.php';

$t = new lime_test(1);
$t = new lime_test(2);

// ::removeObjects()
$t->diag('::removeObjects()');
$objectArray = array('foo', 42, new sfDebug(), array('bar', 23, new lime_test(null)));
$cleanedArray = array('foo', 42, 'sfDebug Object()', array('bar', 23, 'lime_test Object()'));
$t->is_deeply(sfDebug::removeObjects($objectArray), $cleanedArray, '::removeObjects() converts objects to String representations using the class name');

$t->diag('::shortenFilePath()');
$t->is(sfDebug::shortenFilePath(null), null, '->shortenFilePath() handles a null value');