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