public function FilesystemCase::testSbit

8.0.x filesystemTest.php public FilesystemCase::testSbit()
6.x filesystemTest.php public FilesystemCase::testSbit()
7.x filesystemTest.php public FilesystemCase::testSbit()
5.x filesystemTest.php public FilesystemCase::testSbit()
master filesystemTest.php public FilesystemCase::testSbit()

File

tests/filesystemTest.php, line 10

Class

FilesystemCase
Filesystem related testing.

Code

public function testSbit() {
  if ($this->is_windows()) {
    $this->markTestSkipped("s-bit test doesn't apply on Windows.");
  }
  if (is_null(UNISH_USERGROUP)) {
    $this->markTestSkipped("s-bit test skipped because of UNISH_USERGROUP was not set.");
  }

  $dest = UNISH_SANDBOX . '/test-filesystem-sbit';
  mkdir($dest);
  chgrp($dest, UNISH_USERGROUP);
  chmod($dest, 02755); // rwxr-sr-x

  $this->drush('pm-download', array('devel'), array('cache' => NULL, 'skip' => NULL, 'destination' => $dest));

  $group = posix_getgrgid(filegroup($dest . '/devel/README.txt'));
  $this->assertEquals($group['name'], UNISH_USERGROUP, 'Group is preserved.');

  $perms = fileperms($dest . '/devel') & 02000;
  $this->assertEquals($perms, 02000, 's-bit is preserved.');
}