If you’re on Windows, open wp-tests-config.php and change the ABSPATH with absolute path to your TEMP folder. For example:
define( 'ABSPATH', 'C:\Users\{User}\AppData\Local\Temp/wordpress/' );
I changed this and phpunit worked! This code is on line 7 in %TEMP%/wordpress-tests-lib/wp-tests-config.php