filesystemTest.php

  1. 8.0.x tests/filesystemTest.php
  2. 6.x tests/filesystemTest.php
  3. 7.x tests/filesystemTest.php
  4. 5.x tests/filesystemTest.php
  5. master tests/filesystemTest.php

Classes

Namesort ascending Description
FilesystemCase Filesystem related testing.

File

tests/filesystemTest.php
View source
  1. <?php
  2. /**
  3. * Filesystem related testing.
  4. *
  5. * @group base
  6. */
  7. class FilesystemCase extends Drush_CommandTestCase {
  8. public function testSbit() {
  9. if ($this->is_windows()) {
  10. $this->markTestSkipped("s-bit test doesn't apply on Windows.");
  11. }
  12. if (is_null(UNISH_USERGROUP)) {
  13. $this->markTestSkipped("s-bit test skipped because of UNISH_USERGROUP was not set.");
  14. }
  15. $dest = UNISH_SANDBOX . '/test-filesystem-sbit';
  16. mkdir($dest);
  17. chgrp($dest, UNISH_USERGROUP);
  18. chmod($dest, 02755); // rwxr-sr-x
  19. $this->drush('pm-download', array('devel'), array('cache' => NULL, 'skip' => NULL, 'destination' => $dest));
  20. $group = posix_getgrgid(filegroup($dest . '/devel/README.txt'));
  21. $this->assertEquals($group['name'], UNISH_USERGROUP, 'Group is preserved.');
  22. $perms = fileperms($dest . '/devel') & 02000;
  23. $this->assertEquals($perms, 02000, 's-bit is preserved.');
  24. }
  25. public function testExecuteBits() {
  26. if ($this->is_windows()) {
  27. $this->markTestSkipped("execute bit test doesn't apply on Windows.");
  28. }
  29. $dest = UNISH_SANDBOX . '/test-filesystem-execute';
  30. mkdir($dest);
  31. $this->execute(sprintf("git clone https://github.com/drush-ops/drush.git %s", $dest . '/drush'));
  32. $perms = fileperms($dest . '/drush/drush') & 0111;
  33. $this->assertEquals($perms, 0111, 'Execute permission is preserved.');
  34. }
  35. }