I have magic method getData
. Is it possible to call following inside unit test:
$this->attributeMock
->method('getData')
->with('additional_data')
->willReturn('some value');
$this->attributeMock
->method('getData')
->with('is_default')
->willReturn('something');
When I do this, I got:
Failed asserting that two strings are equal.
--- Expected
+++ Actual @@ @@
-'is_default'
+'additional_data'
Is there some another way?
You should use the PHPUnit
at()
method to check method invocation at certain index.So you can use the following code:
You can check the following article for some reference:
http://www.andrejfarkas.com/2012/07/phpunit-at-method-to-check-method-invocation-at-certain-index/