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

Class name of expected function call #3676

Open
panvid opened this issue May 2, 2019 · 0 comments
Open

Class name of expected function call #3676

panvid opened this issue May 2, 2019 · 0 comments
Labels
feature/test-doubles Test Stubs and Mock Objects type/enhancement A new idea that should be implemented

Comments

@panvid
Copy link
Contributor

panvid commented May 2, 2019

Q A
PHPUnit version 7.5.9
PHP version 7.3.4
Installation Method PHAR

It would be nice if the failed expection of method calling will be extended with the class, which has this function. Sometimes their are some function names in mocked classes. The now existing error message will not say which expectation is not fulfilled.

Message right now:

Expectation failed for method name is equal to 'map' when invoked 1 time(s).
Method was expected to be called 1 times, actually called 0 times.

Better message:

Expectation failed for class `'ResponseMapper' with method name is equal to 'map' when invoked 1 time(s).
Method was expected to be called 1 times, actually called 0 times.

Code example:

$responseMapper = $this->createMock(ResponseMapper::class);
$responseMapper->expects(self::once())->method('map')->willReturn([]);

$requestMapper = $this->createMock(RequestMapper::class);
$requestMapper->expects(self::once())->method('map')->willReturn([]);
@sebastianbergmann sebastianbergmann changed the title Improvement: Class name of expected function call Class name of expected function call May 6, 2019
@sebastianbergmann sebastianbergmann added type/enhancement A new idea that should be implemented feature/test-doubles Test Stubs and Mock Objects labels May 6, 2019
@epdenouden epdenouden added the event/code-sprint/2019-09 PHPUnit Code Sprint: September 2019 label Sep 6, 2019
matthiasschobner added a commit to matthiasschobner/phpunit that referenced this issue Sep 7, 2019
@sebastianbergmann sebastianbergmann removed the event/code-sprint/2019-09 PHPUnit Code Sprint: September 2019 label Oct 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/test-doubles Test Stubs and Mock Objects type/enhancement A new idea that should be implemented
Projects
None yet
Development

No branches or pull requests

3 participants