Commit 4670f28f authored by Patrick Barroca's avatar Patrick Barroca 🐧

Merge branch 'php7-compat' into 'master'

Php7 compat

See merge request !16
parents e5539809 a2c7a4f0
......@@ -404,9 +404,12 @@ class Storm_Model_Loader {
public function findAllBy($args) {
$filter_given_func = isset($args['callback']) ? $args['callback'] : null;
$filter_func = isset($args['select'])
? function($model) use($args){ return $model->$args['select'](); }
: null;
$filter_func = null;
if (isset($args['select'])) {
$select = $args['select'];
$filter_func = function($model) use($select) { return $model->$select(); };
}
unset($args['select']);
unset($args['callback']);
......
......@@ -65,7 +65,10 @@ class Storm_Test_ObjectWrapper {
* @return Storm_Test_ObjectWrapper
*/
public static function mock($name = '') {
if (!$name) $name = 'from '.xdebug_call_file().':'.xdebug_call_line();
if (!$name) {
$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
$name = 'from ' . $stack[0]['file'] . ':' . $stack[0]['line'];
}
return self::on(new Storm_Test_Mock($name));
}
......
......@@ -31,7 +31,8 @@ trait Storm_Test_THelpers {
public function mock() {
return Storm_Test_ObjectWrapper::mock('from '.xdebug_call_file().':'.xdebug_call_line());
$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
return Storm_Test_ObjectWrapper::mock('from ' . $stack[0]['file'] . ':' . $stack[0]['line']);
}
......
......@@ -43,7 +43,8 @@ class Storm_Test_MockTest extends Storm_Test_ModelTestCase {
try {
$this->mock()->beStrict()->zork();
} catch (Storm_Test_ObjectWrapperException $e) {
$this->assertContains('Cannot find redirection for Storm_Test_Mock', $e->getMessage());
$this->assertContains('Cannot find redirection for Storm_Test_Mock',
$e->getMessage());
$this->assertContains('Storm/Test/MockTest.php:44]', $e->getMessage());
return;
}
......
zf @ 0f49c4f1
Subproject commit 5282218c4331c9b10da73917340c3b6c7c0af465
Subproject commit 0f49c4f1d0c252fd1d0f3066fcb0d9a449de2551
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment