TIL: expectedDeprecated

I learned today that WP_UnitTestCase (the class that WP uses for PHPUnit tests) offers a expectedDeprecated method.

For example:

class WP_Test_Jetpack_User_Agent extends WP_UnitTestCase {
	/**
	 * Confirm an old improper static use of Jetpack_User_Agent_Info still functions.
	 */
	public function test_jetpack_user_agent_is_tablet() {
		$this->setExpectedDeprecated( 'Jetpack_User_Agent_Info::is_tablet' );
		$this->assertFalse( Jetpack_User_Agent_Info::is_tablet() );
	}
}

Leave a Reply

Your email address will not be published. Required fields are marked *