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

Fix #209 - Handle static:: calls for static methods in partial mocks #305

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fkalinski
Copy link

An attempt do deal with mocking static methods in partial mocks so static:: access to the methods works.

$mockGenerator->generate($newClassName, $mockedClassList, $this->infoRegistry);

$this->cachedClasses[implode('__', $mockedClassList)] = $newClassName;
if ($cache) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand your patch you are always regenerating a new class everytime you're using the partialMock method. This may lead to a bigger memory consumption.

Would it make sense to only cache two différent versions of the mocked class ? One for Phake::mock() and one for Phake::partialMock() ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants