Permalink
Browse files

Add test cases to include $exceptions with Folder::chmod()

  • Loading branch information...
1 parent a821723 commit d725869507d2420784666c66f6ed2a1d6a850143 @shama shama committed Nov 15, 2011
Showing with 19 additions and 4 deletions.
  1. +19 −4 lib/Cake/Test/Case/Utility/FolderTest.php
@@ -268,11 +268,26 @@ public function testChmod() {
$filePath = $new . DS . 'test1.php';
$File = new File($filePath);
$this->assertTrue($File->create());
- $copy = TMP . 'test_folder_copy';
-
- $this->assertTrue($Folder->chmod($new, 0777, true));
- $this->assertEqual($File->perms(), '0777');
+
+ $filePath = $new . DS . 'skip_me.php';
+ $File = new File($filePath);
+ $this->assertTrue($File->create());
+ $this->assertTrue($Folder->chmod($new, 0755, true));
+ $this->assertTrue($Folder->chmod($new, 0777, true, array('skip_me.php', 'test2')));
+
+ $perms = substr(sprintf('%o', fileperms($new . DS . 'test1')), -4);
+ $this->assertEqual($perms, '0777');
+
+ $perms = substr(sprintf('%o', fileperms($new . DS . 'test2')), -4);
+ $this->assertEqual($perms, '0755');
+
+ $perms = substr(sprintf('%o', fileperms($new . DS . 'test1.php')), -4);
+ $this->assertEqual($perms, '0777');
+
+ $perms = substr(sprintf('%o', fileperms($new . DS . 'skip_me.php')), -4);
+ $this->assertEqual($perms, '0755');
+
$Folder->delete($new);
}

0 comments on commit d725869

Please sign in to comment.