$exampleCopyPath = __DIR__ . '/tmp/target/'; $fileObject = new File($examplePath); $fileObject->copy($exampleCopyPath); $fileObject->rename('example_copy.txt'); echo 'Move copied file to a new directory'; echo '<br/>'; $exampleMovePath = __DIR__ . '/tmp/target/move/'; $fileObject->move($exampleMovePath); $fileObject->rename('example_move.txt'); echo 'Moved File ' . $fileObject->getPathname() . ' do' . ($fileObject->exists() ? '' : ' not') . ' exist.'; echo '<br/>'; echo 'File is' . ($fileObject->isReadable() ? '' : ' not') . ' readable.'; echo '<br/>'; echo 'File is' . ($fileObject->isWritable() ? '' : ' not') . ' writeable.'; echo '<br/>'; echo 'File permission: ' . $fileObject->getPermission(); echo '<br/>'; echo '<br/>'; echo 'Remove file'; echo '<br/>'; $deletePath = __DIR__ . '/tmp/example.txt'; $fileObject = new File($deletePath); $fileObject->delete(); echo 'Remove directories'; echo '<br/>'; $deletePath = __DIR__ . '/tmp/target/'; $fileObject = new File($deletePath); $fileObject->deleteAll(); $examplePath = __DIR__ . '/ExampleDir'; $fileObject = new File($examplePath); echo '<br/>';
/** * @depends testExist * @return void */ public function testChmodWithAllModes() { $modes = array('0600', '0640', '0660', '0604', '0606', '0664', '0666', '0700', '0740', '0760', '0770', '0704', '0706', '0707', '0744', '0746', '0747', '0754', '0755', '0756', '0757', '0764', '0766', '0767', '0774', '0775', '0776', '0777'); $filePath = __DIR__ . '/example.txt'; $fileObject = new File($filePath); foreach ($modes as $mode) { $this->assertTrue($fileObject->chmod($mode)); clearstatcache(); $this->assertEquals($mode, $fileObject->getPermission()); } }