Skip to content

Commit 2666b34

Browse files
author
Shohei Yamasaki
committed
Display got params
1 parent 3b7e8ed commit 2666b34

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/AspectMock/Proxy/Verifier.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ abstract class Verifier {
1616
*/
1717
public $className;
1818

19-
protected $invokedFail = "Expected %s to be invoked but it never occur.";
19+
protected $invokedFail = "Expected %s to be invoked but it never occur. Got: %s";
2020
protected $notInvokedMultipleTimesFail = "Expected %s to be invoked %s times but it never occur.";
2121
protected $invokedMultipleTimesFail = "Expected %s to be invoked but called %s times but called %s.";
2222

@@ -67,8 +67,10 @@ public function verifyInvoked($name, $params = null)
6767
foreach ($calls as $args) {
6868
if ($this->onlyExpectedArguments($params, $args) === $params) return;
6969
}
70-
$params = ArgumentsFormatter::toString($params);
71-
throw new fail(sprintf($this->invokedFail, $this->className.$separator.$name."($params)"));
70+
$params = ArgumentsFormatter::toString($params);
71+
$gotParams = ArgumentsFormatter::toString($calls[0]);
72+
73+
throw new fail(sprintf($this->invokedFail, $this->className.$separator.$name."($params)", $this->className.$separator.$name."($gotParams)"));
7274
} else if(is_callable($params)) {
7375
$params($calls);
7476
}

0 commit comments

Comments
 (0)