FIXED: PHP Unit test issue PHP Warning/Warning/Fatal error: Failed to open stream: No such file (mock-mailer.php) for windows

After setup the PHP unit test on your Windows operating system maybe you get below error:

PHP Warning:  require_once(/tmp/wordpress//wp-includes/class-phpmailer.php): failed to open stream: No such file or directory in C:\Users\MaheshW\AppData\Local\Temp\wordpress-tests-lib\includes\mock-mailer.php o
n line 2
...
...
Warning: require_once(/tmp/wordpress//wp-includes/class-phpmailer.php): failed to open stream: No such file or directory in C:\Users\MaheshW\AppData\Local\Temp\wordpress-tests-lib\includes\mock-mailer.php on lin
e 2
...
...
PHP Fatal error:  require_once(): Failed opening required '/tmp/wordpress//wp-includes/class-phpmailer.php' (include_path='C:\xampp\php\PEAR') in C:\Users\MaheshW\AppData\Local\Temp\wordpress-tests-lib\includes\
mock-mailer.php on line 2
...
...
Fatal error: require_once(): Failed opening required '/tmp/wordpress//wp-includes/class-phpmailer.php' (include_path='C:\xampp\php\PEAR') in C:\Users\MaheshW\AppData\Local\Temp\wordpress-tests-lib\includes\mock-
mailer.php on line 2
...
...

In file C:\Users\MaheshW\AppData\Local\Temp\wordpress-tests-lib\wp-tests-config.php line 7 has code:

define( 'ABSPATH', '/tmp/wordpress/' );

Here, ABSPATH return the invalid path.

You can simply change the above code with below:

define( 'ABSPATH', 'C:\Users\{USERNAME}\AppData\Local\Temp/wordpress/' );

NOTE: Here change the {USERNAME} with your own user name.

To know the user name just open command prompt which shows your username.

E.g.

In my case it was MaheshW so, I have change the code as below:

define( 'ABSPATH', 'C:\Users\MaheshW\AppData\Local\Temp/wordpress/' );