pest
pest copied to clipboard
[Bug]: `toHaveMethod` Arch Expectation is Overwriting `toHaveMethod` of Common Expectations
What Happened
The toHaveMethod
in the Arch plugin, which was added on this PR: https://github.com/pestphp/pest/pull/947, is overwriting the toHaveMethod
from common expectations. The same doesn't happen to the toHaveMethods
because the Arch plugin doesn't contain this expectation.
How to Reproduce
The test:
test('pass', function () {
$object = new class
{
public function foo(): void
{
//
}
};
expect($object)->toHaveMethod('foo');
});
... Will fail:
Sample Repository
No response
Pest Version
Latest
PHP Version
8.2.9
Operation System
macOS
Notes
It was not noticed on the PR that adds the toHaveMethod
in the Arch plugin, because the toHaveMethod
from common expectations is not tested, only the toHaveMethods
from common expectations are tested here
+1, note that toHaveMethods
works in the meantime with a singular item array, ie expect($object)->toHaveMethods(['foo']);
.
Not ideal 🤦🏻♂️ , but will prevent the suite from failing until this is fixed.