-
Notifications
You must be signed in to change notification settings - Fork 25
Removed create_function()
function usage
#32
Conversation
$mock = $this->getMockBuilder('Foo') | ||
->setMethods(['getValue']) | ||
->getMock(); | ||
$mock->method('getValue') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like section ->expects($this->once())
is missing here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't matter how many times getValue
will be called, that's why expects
is not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case would be better to use ->expects($this->any())
to make it clear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this test case, in general, it doesn't matter how many times the method will be called, so any()
is redundant. The expects()
may sense to use when we need to know if the method is called or not (corner cases, like business logic conditionals) or how many times it was called - for performance reasons.
I don't see, how any()
makes test a cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Good point. Let's leave it as is
#32 CMS block coverage
…ions #32 - Merge Pull Request magento/bulk-api-ce#32 from magento/bulk-api-ce:amqp-optional-consummers - Merged commits: 1. 9a757cb
Removed
create_function()
function usageFixed Issues
Changes for EE in the internal branch https://github.com/magento-mpi/magento2ee/tree/G%238
Contribution checklist