开发者

PHPUnit StackTest::assertEmpty() deprecated

I am learning building php unit tests using PHPUnit . There they have a manual and I encountered this example Where they use assertEmpty(), but when I run this code in command line I get this error : Call to undefined method StackTest::assertEmpty() in /var/www/.../tests/StackTest.php on line 20. So if this method is deprecated or something why they use it , also is there 开发者_如何学运维another method for this? (of course I can try this $this->assertEquals(0, count($stack));) but anyways... The same with assertNotEmpty().


I'm on debian, and it looks like the default install of PHPunit is a bit old (3.4.14).

If you search for "assertEmpty" in this url, you will see what version it was added in (3.5.0-1). http://packages.debian.org/changelogs/pool/main/p/phpunit/phpunit_3.6.10-1/changelog.html

What worked for me was removing phpunit from the system with apt, and installing it with pear http://www.santiagolizardo.com/article/how-to-install-pear-and-phpunit-in-debianubuntu/57001

These links also helped me. "Fatal error: Call to undefined method PHPUnit_Util_Filter::addfiletofilter() in /usr/bin/phpunit on line 48"

Cannot get PHPunit working


Are you running the unit test from the command line with the phpunit command line tools?

phpunit --verbose StackTest stacktest.php
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜