From f5c2b0e53fba7813dcea97391b05d61df5b74bea Mon Sep 17 00:00:00 2001 From: gitlost Date: Mon, 22 May 2017 13:19:40 +0100 Subject: [PATCH] Behat _error_log() & _var_dump(). --- features/bootstrap/debug.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 features/bootstrap/debug.php diff --git a/features/bootstrap/debug.php b/features/bootstrap/debug.php new file mode 100644 index 0000000000..24ac40e5ad --- /dev/null +++ b/features/bootstrap/debug.php @@ -0,0 +1,29 @@ += 7. + function _var_dump( $var ) { + $ret = ''; + if ( $php_ver_7 = version_compare( PHP_VERSION, '7', '>=' ) ) { + $bt = debug_backtrace( 0, 1 ); + $file_line = isset( $bt[0] ) ? "{$bt[0]['file']}:{$bt[0]['line']}:\n" : ''; + } + for ( $i = 0, $cnt = func_num_args(); $i < $cnt; $i++ ) { + ob_start(); + var_dump( func_get_arg( $i ) ); + $v = ob_get_clean(); + $ret .= $php_ver_7 ? preg_replace( '/^.*?:\n/', $file_line, $v ) : $v; + } + return $ret; + } +}