Fatal error: Uncaught UnexpectedValueException: RecursiveDirectoryIterator::__construct(/var/www/drupalvm/drupal/web/profiles) during PHPUnit tests execution
Issue Type
- Bug Report / Support Request
Environment
PHPUnit 6.3.2
Drupal 8.3.5
Vagrant 1.9.5
VirtualBox 5.1.24r117012
ansible 2.3.1.0
config file =
configured module search path = Default w/o overrides
python version = 2.7.13 (default, Jul 18 2017, 09:17:00) [GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)]
OS
- macOS (Sierra)
Full console output
PHP Fatal error: Uncaught UnexpectedValueException: RecursiveDirectoryIterator::__construct(/var/www/drupalvm/drupal/web/profiles): failed to open dir: No such file or directory in /var/www/drupalvm/drupal/web/core/tests/bootstrap.php:23
Stack trace:
#0 /var/www/drupalvm/drupal/web/core/tests/bootstrap.php(23): RecursiveDirectoryIterator->__construct('/var/www/drupal...', 512)
#1 [internal function]: drupal_phpunit_find_extension_directories('/var/www/drupal...')
#2 /var/www/drupalvm/drupal/web/core/tests/bootstrap.php(138): array_map('drupal_phpunit_...', Array)
#3 /var/www/drupalvm/drupal/web/core/tests/bootstrap.php(150): drupal_phpunit_populate_class_loader()
#4 /var/www/drupalvm/drupal/vendor/phpunit/phpunit/src/Util/Fileloader.php(61): include_once('/var/www/drupal...')
#5 /var/www/drupalvm/drupal/vendor/phpunit/phpunit/src/Util/Fileloader.php(45): PHPUnit\Util\Fileloader::load('/var/www/drupal...')
#6 /var/www/drupalvm/drupal/vendor/phpunit/phpunit/src/TextUI/Command.php(913): PHPUnit\Util\Fileloader::checkAndLoad('/va in /var/www/drupalvm/drupal/web/core/tests/bootstrap.php on line 23
Summary
I've followed these instructions: https://www.drupal.org/docs/8/phpunit/running-phpunit-tests-within-phpstorm
I've installed phpunit via composer require --dev phpunit/phpunit
If I create profiles directory with some content, I have similar error about themes directory.
@drupality - This seems to be more of an issue that would fit Drupal Answers more than the Drupal VM issue queue: https://drupal.stackexchange.com
It sounds like you would need to have a working Drupal installation before you could use PHP unit with it. E.g. use composer and drupal-project to build a Drupal codebase, then add phpunit, then add tests, then run tests.
I don't personally use PHPStorm, so there again, you'd probably get more eyeballs on this issue in Drupal Answers than here.