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

Fatal error when extenting TestCase without calling parent constructor #1164

Closed
voda opened this issue Mar 7, 2014 · 0 comments · Fixed by #1165
Closed

Fatal error when extenting TestCase without calling parent constructor #1164

voda opened this issue Mar 7, 2014 · 0 comments · Fixed by #1165

Comments

@voda
Copy link

voda commented Mar 7, 2014

In one of my test I had defined a constructor and forgot to call the parent constructor. When trying to run this test phpunit crashed with Fatal error: Call to a member function getMock() on a non-object in phar:///usr/bin/phpunit/phpunit/Framework/TestCase.php on line 1301. It took me some time the find the wrong test, because there is no stacktrace. This is an issue with PHPUnit 4, the test worked in PHPUnit 3.x. It would be nice to print a message saying something like 'Call parent::__construct in class foo.'

chrisguitarguy added a commit to chrisguitarguy/phpunit that referenced this issue Mar 7, 2014
Fixes sebastianbergmann#1164

Instead of setting up the mock object generator in TestCase's
constructor, it's created whenever a call to `getMockObjectGenerator` is
made.
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 a pull request may close this issue.

1 participant