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 *

Your post must include a link to this post.

How does this work?
Write a response on your own website and include a link to this post. Then submit your response’s URL here. Your response may appear here after moderation. To update or remove it, edit or delete your original post and submit the same URL again. Learn more about Webmentions.