Git clone the WordPress develop repository somewhere on your hard drive:
git clone firstname.lastname@example.org:WordPress/wordpress-develop.git
wordpress-develop/tests/phpunit/includes/phpunit6-compat.php in a text editor.
PHPUnit version 5: Comment out the
class_alias() functions in
phpunit6-compat.php because these break PhpStorm code completion. (These files aren’t actually used by the testing framework, we only downloaded them so they could be included in the Project Configuration’s Include Path.)
PHPUnit version 6 and up: Do the same thing as PHPUnit 5, the paragraph above, except leave this line uncommented:
class_alias( 'PHPUnitFrameworkTestCase', 'PHPUnit_Framework_TestCase' );
In PhpStorm, go to: Settings -> Languages & Frameworks -> PHP and add
wordpress-develop/tests/phpunit/includes to your Include Path.
Write tests that extend
WP_UnitTestCase. Look at the code in
wordpress-develop/tests/phpunit/tests for examples.