If you are using a machine that for one reason or another can not be immediately upgraded to have PHP 5.3.3 or above (which PHPUnit 3.7 requires), then you can fix this error by downgrading packages.
pear list -a
should produce something like:
Installed packages, channel pear.phpunit.de:
============================================
Package Version State
File_Iterator 1.3.3 stable
PHPUnit 3.6.12 stable
PHPUnit_MockObject 1.1.1 stable
PHP_CodeCoverage 1.1.4 stable
PHP_Timer 1.0.4 stable
PHP_TokenStream 1.1.4 stable
Text_Template 1.1.2 stable
You need the 1.3.2 version of File_Iterator, the 1.1.1 version of Text_Template, and the 1.0.3 version of PHP_Timer.
So uninstall the old:
pear uninstall phpunit/PHPUnit
pear uninstall phpunit/PHPUnit_MockObject
pear uninstall phpunit/PHP_CodeCoverage
pear uninstall phpunit/File_Iterator
pear uninstall phpunit/PHP_Timer
pear uninstall phpunit/PHP_TokenStream
pear uninstall phpunit/Text_Template
You should be able to verify that you have no phpunit packages installed:
pear list -a
Installed packages, channel pear.phpunit.de:
============================================
(no packages installed)
Now explicitly install these dependency versions first:
pear install phpunit/File_Iterator-1.3.2
pear install phpunit/PHP_Timer-1.0.3
pear install phpunit/Text_Template-1.1.1
Then PHPUnit:
pear install --alldeps phpunit/PHPUnit
pear list -a
Installed packages, channel pear.phpunit.de:
============================================
Package Version State
File_Iterator 1.3.2 stable
PHPUnit 3.6.12 stable
PHPUnit_MockObject 1.1.1 stable
PHP_CodeCoverage 1.1.4 stable
PHP_Invoker 1.1.2 stable
PHP_Timer 1.0.3 stable
PHP_TokenStream 1.1.4 stable
Text_Template 1.1.1 stable
All should work now : )