format('Y-m-d'), Directory::created($dirPath)->format('Y-m-d')); self::assertEquals($now->format('Y-m-d'), Directory::changed($dirPath)->format('Y-m-d')); self::assertTrue(Directory::delete($dirPath)); self::assertFalse(Directory::exists($dirPath)); $dirTestPath = self::BASE . '/dirtest'; self::assertGreaterThan(0, Directory::size($dirTestPath)); self::assertGreaterThan(Directory::size($dirTestPath, false), Directory::size($dirTestPath)); self::assertGreaterThan(0, Directory::permission($dirTestPath)); } public function testStaticMove() { if (!self::TEST) { return; } $dirTestPath = self::BASE . '/dirtest'; self::assertTrue(Directory::copy($dirTestPath, self::BASE . '/newdirtest')); self::assertTrue(file_exists(self::BASE . '/newdirtest/sub/path/test3.txt')); self::assertTrue(Directory::delete($dirTestPath)); self::assertFalse(Directory::exists($dirTestPath)); self::assertTrue(Directory::move(self::BASE . '/newdirtest', $dirTestPath)); self::assertTrue(file_exists($dirTestPath . '/sub/path/test3.txt')); self::assertEquals(4, Directory::count($dirTestPath)); self::assertEquals(1, Directory::count($dirTestPath, false)); self::assertEquals(6, count(Directory::list($dirTestPath))); self::assertEquals(3, count(Directory::listByExtension($dirTestPath, 'txt'))); } /** * @expectedException \phpOMS\System\File\PathException */ public function testInvalidListPath() { if (!self::TEST) { throw new PathException(''); } Directory::list(self::BASE . '/invalid.txt'); } /** * @expectedException \phpOMS\System\File\PathException */ public function testInvalidCopyPath() { if (!self::TEST) { throw new PathException(''); } Directory::copy(self::BASE . '/invalid', self::BASE . '/invalid2'); } /** * @expectedException \phpOMS\System\File\PathException */ public function testInvalidMovePath() { if (!self::TEST) { throw new PathException(''); } Directory::move(self::BASE . '/invalid', self::BASE . '/invalid2'); } /** * @expectedException \phpOMS\System\File\PathException */ public function testInvalidCreatedPath() { if (!self::TEST) { throw new PathException(''); } Directory::created(self::BASE . '/invalid'); } /** * @expectedException \phpOMS\System\File\PathException */ public function testInvalidChangedPath() { if (!self::TEST) { throw new PathException(''); } Directory::changed(self::BASE . '/invalid'); } /** * @expectedException \phpOMS\System\File\PathException */ public function testInvalidSizePath() { if (!self::TEST) { throw new PathException(''); } Directory::size(self::BASE . '/invalid'); } /** * @expectedException \phpOMS\System\File\PathException */ public function testInvalidPermissionPath() { if (!self::TEST) { throw new PathException(''); } Directory::permission(self::BASE . '/invalid'); } /** * @expectedException \phpOMS\System\File\PathException */ public function testInvalidOwnerPath() { if (!self::TEST) { throw new PathException(''); } Directory::owner(self::BASE . '/invalid'); } }