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

Mocking SplFileInfo #218

Open
garethellis36 opened this issue Mar 10, 2016 · 1 comment
Open

Mocking SplFileInfo #218

garethellis36 opened this issue Mar 10, 2016 · 1 comment
Labels

Comments

@garethellis36
Copy link

Hello,

It doesn't seem like it's possible to mock SplFileInfo. The mock creates without complaint, but as soon as you try to call a method on the mock object, PHP throws a Fatal Exception:

LogicException: The parent constructor was not called: the object is in an invalid state

It looks like Mockery has the same issue: mockery/mockery#122

@garethellis36
Copy link
Author

Workaround:

//use "NUL" on Windows for the second argument
$file = Phake::partialMock(SplFileObject::class, "/dev/null");

@adoy adoy added the Defect label Apr 23, 2021
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

2 participants