public function __construct(Exception $exception)
 {
     parent::__construct($exception);
     unset($this->value['file']);
     unset($this->value['line']);
     unset($this->value['trace']);
     unset($this->value['string']);
     // some internal property of \Exception
 }
/**
 * Prints the given value to the error stream in a nicely formatted way.
 *
 * @param mixed $value
 */
function lime_debug($value)
{
    $result = "";
    if (is_object($value) || is_array($value)) {
        $result = is_object($value) ? sprintf("object(%s) (\n", get_class($value)) : "array (";
        if (is_object($value)) {
            $value = LimeTesterObject::toArray($value);
        }
        foreach ($value as $key => $val) {
            if (is_object($val) || is_array($val)) {
                $output = is_object($val) ? sprintf("object(%s) (", get_class($val)) : "array (";
                if (is_object($val)) {
                    $val = LimeTesterObject::toArray($val);
                }
                if (count($val) > 0) {
                    $output .= "\n    ...\n  ";
                }
                $output .= ")";
            } else {
                if (is_string($val) && strlen($val) > 60) {
                    $val = substr($val, 0, 57) . '...';
                }
                $output = lime_colorize($val);
            }
            $result .= sprintf("  %s => %s,\n", var_export($key, true), $output);
        }
        $result .= ")";
    } else {
        $result = lime_colorize($value);
    }
    fwrite(STDERR, $result . "\n");
}
Beispiel #3
0
$actual->isntSame($expected);
// @Test: isntSame() throws no exception when comparing arrays with scalars (2)
// fixtures
$actual = new LimeTesterScalar(false);
$expected = new LimeTesterArray(array());
// test
$actual->isntSame($expected);
// @Test: isntSame() throws no exception when comparing arrays with objects (1)
// fixtures
$actual = new LimeTesterArray(array());
$expected = new LimeTesterObject(new stdClass());
// test
$actual->isntSame($expected);
// @Test: isntSame() throws no exception when comparing arrays with objects (2)
// fixtures
$actual = new LimeTesterObject(new stdClass());
$expected = new LimeTesterArray(array());
// test
$actual->isntSame($expected);
// @Test: isntSame() throws no exception when comparing doubles with strings (1)
// fixtures
$actual = new LimeTesterDouble(1.0);
$expected = new LimeTesterString('1.0');
// test
$actual->isntSame($expected);
// @Test: isntSame() throws no exception when comparing doubles with strings (2)
// fixtures
$actual = new LimeTesterString('1.0');
$expected = new LimeTesterDouble(1.0);
// test
$actual->isntSame($expected);