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

Namespace

Unish

Classes

Namesort descending Description
FilesystemCase Filesystem related testing.

File

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