1

Running from CLI... my tests all pass, but the framework itself is throwing an error when trying to clean up a directory. I am not sure what it is coming from, and how to fix it. The directory sites/simpletest has 777 on it.

vagrant@local:/var/www/mysite/docroot$ ../vendor/bin/phpunit -c ../phpunit.xml modules/custom/netforum_auth
PHPUnit 4.8.35 by Sebastian Bergmann and contributors.

E.......

Time: 24.07 seconds, Memory: 8.00MB

There was 1 error:

1) Drupal\Tests\netforum_auth\Functional\AuthenticationTest::testAdminUserUsesDrupalAuthentication
rmdir(sites/simpletest/52528722): Operation not permitted

/var/www/mysite/docroot/core/lib/Drupal/Core/File/FileSystem.php:256

I'm stuck.

edit: possibly related

edit 2:

Running the command with sudo shows no error. Why? I tried adding vagrant to the web data user group, no difference. Only sudo works. This is in DurpalVM, Drupal 8.3.5.

edit 3:

Per the docs:

export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data

Therefore, this should work:

sudo -u www-data -E ../vendor/bin/phpunit -c ../phpunit.xml

However it works sometimes, and not others. 50% success rate at the moment, with the same file permissions error.

edit 4:

Similar yet different error:

1) Drupal\Tests\netforum_auth\Functional\AuthenticationTest::testAdminUserUsesDrupalAuthentication
Exception: Warning: file_put_contents(sites/simpletest/61504822/files/php/twig/597a393cb6709_form-element.html.twig_dJcTIbdx1y7B0dbOtEyyZSSZ1/.htaccess): failed to open stream: Permission denied
Drupal\Component\PhpStorage\FileStorage->ensureDirectory()() (Line: 122)
  • Did you check the directory the error is referring is empty? – kiamlaluno Jul 27 '17 at 20:40
  • It doesn't tell me which directory it is referring to. It looks like I have run the gamut here for creating, removing, and writing to the simpletest folder created on the test run. The kicker is, sometimes it runs fine, and other times it throws error, with the very same command. – Kevin Jul 27 '17 at 20:41
  • All the test dirs it creates are empty in the end, but not removed. – Kevin Jul 27 '17 at 20:42
  • Try setting the sites/simpletest directory ownership: chown www-data:www-data sites/simpletest – cherner Jul 27 '17 at 22:20
  • I have done this and I have also added the vagrant user to the group, no change. – Kevin Jul 27 '17 at 22:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.