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

Throw exception when there are assertions for a not mocked method #1249

Closed
JeroenDeDauw opened this issue May 5, 2014 · 3 comments
Closed

Comments

@JeroenDeDauw
Copy link
Sponsor Contributor

The below code fails since the method in question is concrete and does not get mocked. That is expected behaviour of the API. However, at least when this type of error occurs as in this example, the issue might not be at all obvious.

$platform = $this->getMock('Doctrine\DBAL\Platforms\AbstractPlatform');

$collector = new DropSchemaSqlCollector($platform);

$platform->expects($this->exactly(2))
    ->method('getDropForeignKeySQL');

Throwing an exception or providing a warning of some kind to the developer would be great.

@whatthejeff
Copy link
Contributor

Would you mind opening this in https://github.com/sebastianbergmann/phpunit-mock-objects?

@JeroenDeDauw
Copy link
Sponsor Contributor Author

@whatthejeff
Copy link
Contributor

Thanks again, @JeroenDeDauw!

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

No branches or pull requests

2 participants