Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Higher Order Testing : conflict with object method getValue() #1297

Open
Arcesilas opened this issue Oct 16, 2024 · 0 comments
Open
Labels

Comments

@Arcesilas
Copy link

Arcesilas commented Oct 16, 2024

What Happened

When I use Higher Order Testing like this:

    it('can be optional')
        ->expect(fn() => $this->param->optional('foo'))
        ->isRequired()->toBeFalse()
        ->getValue()->toBe('foo');

I get an error: ReflectionException: Call to undefined method Namespace\MyClass::toBe()

If I switch the order of calls to getValue() and isRequired():

    it('can be optional')
        ->expect(fn() => $this->param->optional('foo'))
        ->getValue()->toBe('foo')
        ->isRequired()->toBeFalse();

the test passes as expected.

The class tested actually has a method named getValue.

How to Reproduce

See sample repository.

Sample Repository

https://github.com/Arcesilas/pest-bug

Pest Version

3.4.0

PHP Version

8.3.12

Operation System

Linux

Notes

No response

@Arcesilas Arcesilas added the bug label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant