Issue #2672888 by fago: BrowserTestBase fails when the webserver runs as another user

8.3.x
Alex Pott 2016-09-30 17:30:29 +01:00
parent 6416f45978
commit ae621fe689
2 changed files with 10 additions and 5 deletions

View File

@ -1532,7 +1532,11 @@ abstract class TestBase {
* need to get deleted too.
*/
public static function filePreDeleteCallback($path) {
chmod($path, 0700);
// When the webserver runs with the same system user as the test runner, we
// can make read-only files writable again. If not, chmod will fail while
// the file deletion still works if file permissions have been configured
// correctly. Thus, we ignore any problems while running chmod.
@chmod($path, 0700);
}
/**

View File

@ -557,10 +557,11 @@ abstract class BrowserTestBase extends \PHPUnit_Framework_TestCase {
* The file path.
*/
public static function filePreDeleteCallback($path) {
$success = @chmod($path, 0700);
if (!$success) {
trigger_error("Can not make $path writable whilst cleaning up test directory. The webserver and phpunit are probably not being run by the same user.");
}
// When the webserver runs with the same system user as phpunit, we can
// make read-only files writable again. If not, chmod will fail while the
// file deletion still works if file permissions have been configured
// correctly. Thus, we ignore any problems while running chmod.
@chmod($path, 0700);
}
/**