Commit 7aa22a89 authored by Laurent's avatar Laurent

Fix MethodRedirection error report with nested arrays

parent 7aaada2d
Pipeline #9995 passed with stage
in 27 seconds
......@@ -142,10 +142,12 @@ class Storm_Test_MethodRedirection {
/**
*/
public function _raiseShouldNotBeCalledException() {
$expected_params = array_map(function($param) { return var_export($param, true); },
$this->_expected_params);
throw new Storm_Test_MethodRedirectionException(
sprintf("Method %s(%s) was not expected to be called",
$this->_method,
implode(',', $this->_expected_params)));
implode(',', $expected_params)));
}
......
......@@ -33,6 +33,7 @@ class Storm_Test_ObjectWrapperOnUserLoaderTest extends PHPUnit_Framework_TestCas
->whenCalled('findByNameAndAge')->with('Mario', 6)->answers('mario')
->whenCalled('find')->with(5)->answers('zork')
->shouldNotBeCalled('find')->with('glurp')
->shouldNotBeCalled('find')->with(['akey' => ['some', 'values']])
->getWrapper();
}
......@@ -91,12 +92,26 @@ class Storm_Test_ObjectWrapperOnUserLoaderTest extends PHPUnit_Framework_TestCas
/**
* @expectedException Storm_Test_MethodRedirectionException
* @expectedExceptionMessage Method find(glurp) was not expected to be called
* @expectedExceptionMessage Method find('glurp') was not expected to be called
* @test
*/
function findByGlurpShouldRaiseException() {
Storm_Test_Mock_User::getLoader()->find('glurp');
}
/**
* @test
*/
function findByGlurpWithNestedArraysShouldRaiseMethodRedirectionException() {
try {
Storm_Test_Mock_User::getLoader()->find(['akey' => ['some', 'values']]);
} catch (Storm_Test_MethodRedirectionException $e) {
$this->assertContains('Method find(array (', $e->getMessage());
return;
}
$this->fail();
}
}
?>
\ No newline at end of file
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