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

Override default call count expectations via expects() #1146

Merged
merged 3 commits into from Oct 19, 2021
Merged

Override default call count expectations via expects() #1146

merged 3 commits into from Oct 19, 2021

Conversation

ghostwriter
Copy link
Member

By default expects() sets up an expectation that the method should be called once and once only.

http://docs.mockery.io/en/stable/reference/alternative_should_receive_syntax.html#expects
http://docs.mockery.io/en/stable/reference/expectations.html#declaring-call-count-expectations

If accepted, this example code will run as expected.

$this->mock->expects('foo')->atLeast()->once();

// and or

$this->mock->expects()->foo()->atMost()->once();

Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
@Bilge
Copy link
Contributor

Bilge commented Oct 18, 2021

@davedevelopment How does this look to you?

@davedevelopment davedevelopment merged commit 816475d into mockery:master Oct 19, 2021
@davedevelopment
Copy link
Collaborator

Merged, thank you, apologies for the tardiness

@ghostwriter ghostwriter deleted the bugfix/overriding-expects-default-call-count branch October 20, 2021 18:29
@Bilge
Copy link
Contributor

Bilge commented Oct 24, 2021

@davedevelopment Could we get a tag for this?

@freiondrej-lmc
Copy link

@davedevelopment it would be amazing if you could tag this, we've just encountered this behavior in our test suite. It's great that it's been fixed already, but we don't want to require dev-master

@davedevelopment
Copy link
Collaborator

Sorry for the delay. I'll see if I can get around to tagging sometime soon.

@Bilge
Copy link
Contributor

Bilge commented Nov 22, 2021

Bro, what? You just type git tag ver and git push --tag. You literally spent more time typing that comment than just pushing a tag.

@davedevelopment
Copy link
Collaborator

I usually spend a bit of time reviewing what has changed and updating the CHANGELOG etc. It doesn't take long, but I don't have that much time to contribute and I'd rather not rush.

Bilge has annoyed me enough times, he's rarely constructive so I've blocked him.

@ghostwriter ghostwriter self-assigned this May 6, 2023
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.

expects('foo')->atLeast()->once() errors on two calls
4 participants