Closed basz closed 8 years ago
Do not replace $this->assert
with static::assert
for reasons explained here: https://github.com/sebastianbergmann/phpunit/issues/1914#issuecomment-148407321
sigh, awesome. Is that true for any static::phpunitMethod or only the assert* methods?
like what?
static::at(0), static::returnValue(...)
same, use $this here
The PHPUnit maintainer is simply wrong on this issue. I have thoroughly analyzed PHPUnit's code, and unless we are going to declare willfully disregarding the static method calls are OK, then such an important code quality tool as PHPUnit should have code written for it using self::assertEquals()
vs. the contextually ambiguous $this->assertEquals()
.
Or, PHPUnit needs to have a third class that does something like
// Expose static assert methods for people who need them.
class Assert
{
public static function assertEquals($expected, $actual, $memo='')
{
return (new AssertLogic())->assertEquals($expected, $actual, $memo);
}
}
Then extend TestCase
against AssertLogic
. Then literally everyone can be happy, at probably minimal overhead. (if the news are too much, then private static $asserter
.
fix these warning
PHPUnit_Framework_TestCase::getMock() is deprecated
$this->assert
should also be replaced withstatic::assert