Take a look at the WordPress core setup with PHPUnit: https://make.wordpress.org/core/handbook/testing/automated-testing/phpunit/
Using this process rather than rolling your own allows you to leverage the boostrapping (and other customization) specific for WordPress.
From the Codex:
When
phpunit
is invoked, the test suite runs a script that sets up a
default installation of WordPress, with a configuration similar to
what you get with the GUI install. Before any tests are run, the
following steps take place:
- WordPress is bootstrapped (by including
wp-settings.php
). This means that all tests run after the entire WP bootstrap (throughwp_loaded
).- All default content is deleted. This includes sample posts and pages, but does not include the default user or the ‘Uncategorized’ category.
Hope that helps!