<?php use Naucon\File\File; $examplePath = __DIR__ . '/example.txt'; $fileObject = new File($examplePath); echo '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 '<br/>'; echo 'Filesize: ' . $fileObject->getSize() . ' bytes'; echo '<br/>'; echo 'Access Time: ' . $fileObject->lastAccessed()->format('d.m.Y H:s'); echo '<br/>'; echo 'Change Time: ' . $fileObject->lastChanged()->format('d.m.Y H:s'); echo '<br/>'; echo 'Modification Time: ' . $fileObject->lastModified()->format('d.m.Y H:s'); echo '<br/>'; echo '<br/>'; echo 'File Owner: ' . $fileObject->getOwnerName() . ' (' . $fileObject->getOwner() . ')'; echo '<br/>'; echo 'File Group: ' . $fileObject->getGroupName() . ' (' . $fileObject->getGroup() . ')'; echo '<br/>'; echo 'File permission: ' . $fileObject->getPermission(); echo '<br/>'; echo '<br/>'; echo 'Create new directory'; echo '<br/>'; $newDirectoryPath = __DIR__ . '/tmp/target/move/';
/** * @depends testExist * @return void */ public function testSize() { $filePath = __DIR__ . '/example.txt'; $fileObject = new File($filePath); $this->assertGreaterThan(0, $size = $fileObject->getSize()); $fileObject = new \SplFileInfo($filePath); $this->assertGreaterThan(0, $fileObject->getSize()); $this->assertEquals($size, $fileObject->getSize()); }