Skip to content

Create mock to create stub#3042

Closed
greg0ire wants to merge 1 commit intorectorphp:masterfrom
greg0ire:create-mock-to-create-stub
Closed

Create mock to create stub#3042
greg0ire wants to merge 1 commit intorectorphp:masterfrom
greg0ire:create-mock-to-create-stub

Conversation

@greg0ire
Copy link
Copy Markdown
Contributor

No description provided.

Comment thread rector.yaml Outdated
}
source:
- https://github.com/sebastianbergmann/phpunit/issues/3120
set: "phpunit90"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I will revert the commit that contains this file, it's just here for reference.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tip: you can put this into create-rector.yaml file and it won't be commited.
https://github.com/rectorphp/rector/blob/master/.gitignore#L12

That's how I use it

return null;
}

dump($this->methodCallManipulator->findMethodCallNamesOnVariable($parentNode->var));
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I would expect to get all method calls made on $stub and $mock here.

Comment on lines +61 to +63
$stub = $this->createStub(\Exception::class);
$stub->method('getMessage')
->willReturn('a message');
Copy link
Copy Markdown
Member

@TomasVotruba TomasVotruba Mar 22, 2020

Choose a reason for hiding this comment

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

I think I see it

@TomasVotruba
Copy link
Copy Markdown
Member

Replaced by #3042

I had to rework chain method caller resolution, as it was not reliable enough.
Thanks for the intro work and finding the edge case. Your work made it easier to spot the issue :

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.

2 participants