Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Error when mocking abstract class with no abstract methods #22

Merged
1 commit merged into from
Oct 24, 2010
Merged

Error when mocking abstract class with no abstract methods #22

1 commit merged into from
Oct 24, 2010

Conversation

blt04
Copy link
Contributor

@blt04 blt04 commented Sep 24, 2010

When mocking an abstract class with no abstract methods using getMockForAbstractClass() an error occurs:

Argument 2 passed to PHPUnit_Framework_MockObject_Generator::generateMock() must be an
array, null given, called in /usr/share/php/PHPUnit/Framework/MockObject/Generator.php
on line 280 and defined

generateMock() should allow $methods to be null. This indicates no methods should be mocked (see 977).

This pull request fixes this by allowing null while still enforcing type hinting. For more info, see the first paragraph of type hinting.

@fabpot
Copy link
Contributor

fabpot commented Oct 2, 2010

The Symfony2 test suite fails with PHPUnit 3.5.0 because of that problem.

@alexanderilyin
Copy link

Could not test abstract controllers classes in Zend Framework using mock of abstract request. Please take a look on pull.

This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants