ZF-10849: PHPUnit showing deprecated warning on use of assertType() in PHPUnit 3.5.6 against current unit tests


Latest update to PHPUnit 3.5.6 causes the following messages to be repeated many times when running the test suite:

assertType() will be removed in PHPUnit 3.6 and should no longer be used. assertInternalType()
should be used for asserting internal types such as "integer" or "string" whereas
assertInstanceOf() should be used for asserting that an object is an instance of a specified
class or interface.

Since it seems we are now supporting the use of both PHPUnit 3.4 and PHPUnit 3.5 for ZF1 tests (see ZF-10830, ZF-10844), what is the best solution here? My suggestion to maintain compatibility with PHPUnit 3.4 is to replace $this->assertType('ExpectedClass', $actualObject) with $this->assertTrue($actualObject instanceof ExpectedClass). But, the downside is that you lose some verbosity on the reason for a test failure on these assertions without manually digging into the test code.

Any better suggestions?


What about {{$this->assertEquals('ExpectedClass', get_class($actualObject))}}?

And $this->assertEquals('string', gettype($var)) for internal types.

The official word from [~Matthew] is that PHPUnit versions >3.4 are not supported, and there are no plans to update ZFv1 to be compatible with versions later than v3.4