Description

Zend_Test_PHPUnit_ControllerTestCase is broken with PHPUnit 3.3.3 (most recent version) in revision 12333.
ControllerTestCase uses {{PHPUnit_Framework_TestCase::incrementAssertionCounter()}} in line 1099, but this method is not available any more with PHPUnit 3.3.3 (don't know in which version this was removed). The appropriate method in PHPUnit 3.3.3 is {{PHPUnit_Framework_TestCase::addToAssertionCount($count)}}.

Changing to trivial and improvement, as it will work for most users of PHPUnit as-is right now; the improvement is for those tracking svn of PHPUnit.

Posted by Brian Hazzard (bhazzard) on 2009-04-24T05:55:12.000+0000

I too have this issue. I tried changing the source code to the method_exists approach and had no luck. I also tried a hack-fix of defining incrementAssertionCounter in my test class and simply calling addToAssertionCount(1) in it's body... again, no luck. Has this been resolved?

Posted by Brian Hazzard (bhazzard) on 2009-04-24T06:12:44.000+0000

In the meantime "upgrading" to PHPUnit 3.3.16 does indeed fix this problem.

This actually affects more users than those tracking svn of PHPUnit:
Neither incrementAssertionCounter nor addtoAssertionCount exist on versions prior to 3.3.0
incrementAssertionCounter exists on versions 3.3.0 to 3.3.2
addtoAssertionCount exists on versions 3.3.3 and on

You may be wondering why someone would want to use an older version of phpunit. Sadly the latest version that ubuntu gnu/linux packages is 3.2.16:
http://packages.ubuntu.com/jaunty/phpunit
so this bug affects all ubuntu users that want to use a package manager.

As mentioned in the previous comment, somewhat older versions of PHPUnit don't have any of these methods for the simple reason that not all distributions are as keen on keeping everything cutting edge as others :'(

If there's no alternate solution in versions before 3.3.0 of PHPUnit, I suggest a following 'fix':