Changeset 23590 for branches/version-2_13-dev/tests/class
- Timestamp:
- 2014/08/14 11:37:36 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_13-dev/tests/class/util/SC_Utils/SC_Utils_recursiveMkDirTest.php
r23546 r23590 35 35 { 36 36 37 static $TMP_DIR;37 static $TMP_DIR; 38 38 39 protected function setUp()40 {41 self::$TMP_DIR = realpath(dirname(__FILE__)) . "/../../../tmp";42 SC_Helper_FileManager::deleteFile(self::$TMP_DIR);43 mkdir(self::$TMP_DIR, 0777, true);44 // parent::setUp();45 }39 protected function setUp() 40 { 41 self::$TMP_DIR = realpath(dirname(__FILE__)) . "/../../../tmp"; 42 SC_Helper_FileManager::deleteFile(self::$TMP_DIR); 43 mkdir(self::$TMP_DIR, 0777, true); 44 // parent::setUp(); 45 } 46 46 47 protected function tearDown()48 {49 // parent::tearDown();50 }47 protected function tearDown() 48 { 49 // parent::tearDown(); 50 } 51 51 52 /////////////////////////////////////////53 public function testRecursiveMkdir_パーミッションを指定した場合_指定のパーミッションでディレクトリが作られる()54 {55 $path = realpath(dirname(__FILE__)) . "/../../../tmp/dir1/dir2/dir3/";56 $mode = 0755;52 ///////////////////////////////////////// 53 public function testRecursiveMkdir_パーミッションを指定した場合_指定のパーミッションでディレクトリが作られる() 54 { 55 $path = realpath(dirname(__FILE__)) . "/../../../tmp/dir1/dir2/dir3/"; 56 $mode = 0755; 57 57 58 $result = SC_Utils::recursiveMkdir($path, $mode); 59 $this->expected = '0755'; 60 $this->actual = substr(sprintf('%o', fileperms($path)), -4); 58 $result = SC_Utils::recursiveMkdir($path, $mode); 59 if (DIRECTORY_SEPARATOR == '\\') { 60 // Windows環境ではパーミッションを指定したディレクトリ作成が出来ない 61 $this->expected = true; 62 $this->actual = file_exists($path); 63 $this->verify('作成したディレクトリがあるかどうか'); 64 } else { 65 $this->expected = '0755'; 66 $this->actual = substr(sprintf('%o', fileperms($path)), -4); 67 $this->verify('作成したディレクトリのパーミッション'); 68 } 61 69 62 $this->verify('作成したディレクトリのパーミッション'); 63 } 70 } 64 71 65 public function testRecursiveMkdir_パーミッションを指定しない場合_0777でディレクトリが作られる()66 {67 $path = realpath(dirname(__FILE__)) . "/../../../tmp/dir1/dir2/dir3/";72 public function testRecursiveMkdir_パーミッションを指定しない場合_0777でディレクトリが作られる() 73 { 74 $path = realpath(dirname(__FILE__)) . "/../../../tmp/dir1/dir2/dir3/"; 68 75 69 $result = SC_Utils::recursiveMkdir($path); 70 $this->expected = '0777'; 71 $this->actual = substr(sprintf('%o', fileperms($path)), -4); 76 $result = SC_Utils::recursiveMkdir($path); 77 if (DIRECTORY_SEPARATOR == '\\') { 78 // Windows環境ではパーミッションを指定したディレクトリ作成が出来ない 79 $this->expected = true; 80 $this->actual = file_exists($path); 81 $this->verify('作成したディレクトリがあるかどうか'); 82 } else { 83 $this->expected = '0777'; 84 $this->actual = substr(sprintf('%o', fileperms($path)), -4); 85 $this->verify('作成したディレクトリのパーミッション'); 86 } 72 87 73 $this->verify('作成したディレクトリのパーミッション'); 74 } 88 } 75 89 76 //////////////////////////////////////////90 ////////////////////////////////////////// 77 91 } 78 92
Note: See TracChangeset
for help on using the changeset viewer.
