PHP code example of stephenharris / phpunit-require-wordpress-version

1. Go to this page and download the library: Download stephenharris/phpunit-require-wordpress-version library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

stephenharris / phpunit-require-wordpress-version example snippets


class My_Test_Case extends WP_UnitTestCase {
	use StephenHarris\PHPUnit\RequiresWordPressVersion;

}

class My_Test extends My_Test_Case {

	/**
	 * @ta() {
		 	// test will be skipped unless WordPress >= 4.4.0
	 }

}-

class My_Test_Case extends WP_UnitTestCase {
	use StephenHarris\PHPUnit\RequiresWordPressVersion;

}

class My_Test_Case extends WP_UnitTestCase {
	use StephenHarris\PHPUnit\RequiresWordPressVersion {
		checkRequirements as checkWordPressVersionRequirements;
	}

	function checkRequirements() {
		$this->checkWordPressVersionRequirements();

		//... your checkRequirements() method here
	}

}

class My_Test_Case extends WP_UnitTestCase {
	use StephenHarris\PHPUnit\RequiresWordPressVersion {
		checkRequirements as checkWordPressVersionRequirements;
	}
	use Some\Other\checkRequirementsTrait {
		checkRequirements as checkSomeOtherRequirements;
	}

	function checkRequirements() {
		$this->checkWordPressVersionRequirements();
		$this->checkSomeOtherRequirements();
	}

}

class My_Test extends My_Test_Case {

	/**
	 * @() {
		 	// test will be skipped unless WordPress >= 4.4.0
	 }

	/**
	 * @23
		 	// also works if you specify 4.4-alpha-123 instead
	 }

	/**
	 * @
	 */
	 function testOnlyRunsForWordPress460() {
	 	 // test will only run with version 4.6.0
	 }

	/**
	 * @s WordPress <= 4.2.0
	 */
	function testOnlyRunsFor420AndEarlier() {
		// test will only run for WordPress version 4.2.0 and earlier
	}

}

/**
 * @

/**
 * @