format('Y-m-d'), File::created($testFile)->format('Y-m-d')); self::assertEquals($now->format('Y-m-d'), File::changed($testFile)->format('Y-m-d')); self::assertGreaterThan(0, File::size($testFile)); self::assertGreaterThan(0, File::permission($testFile)); $newPath = self::BASE . '/sub/path/testing.txt'; self::assertTrue(File::copy($testFile, $newPath)); self::assertTrue(File::exists($newPath)); self::assertFalse(File::copy($testFile, $newPath)); self::assertTrue(File::copy($testFile, $newPath, true)); self::assertEquals('test5test3test4', File::get($newPath)); $newPath2 = self::BASE . '/sub/path/testing2.txt'; self::assertTrue(File::move($testFile, $newPath2)); self::assertTrue(File::exists($newPath2)); self::assertFalse(File::exists($testFile)); self::assertEquals('test5test3test4', File::get($newPath2)); self::assertTrue(File::delete($newPath2)); self::assertFalse(File::exists($newPath2)); self::assertFalse(File::delete($newPath2)); unlink($newPath); rmdir(self::BASE . '/sub/path/'); rmdir(self::BASE . '/sub/'); self::assertTrue(File::create($testFile)); self::assertFalse(File::create($testFile)); self::assertEquals('', File::get($testFile)); unlink($testFile); } /** * @expectedException \phpOMS\System\File\PathException */ public function testInvalidGetPath() { if (!self::TEST) { throw new PathException(''); } File::get(self::BASE . '/invalid.txt'); } /** * @expectedException \phpOMS\System\File\PathException */ public function testInvalidCopyPath() { if (!self::TEST) { throw new PathException(''); } File::copy(self::BASE . '/invalid.txt', self::BASE . '/invalid2.txt'); } /** * @expectedException \phpOMS\System\File\PathException */ public function testInvalidMovePath() { if (!self::TEST) { throw new PathException(''); } File::move(self::BASE . '/invalid.txt', self::BASE . '/invalid2.txt'); } /** * @expectedException \phpOMS\System\File\PathException */ public function testInvalidCreatedPath() { if (!self::TEST) { throw new PathException(''); } File::created(self::BASE . '/invalid.txt'); } /** * @expectedException \phpOMS\System\File\PathException */ public function testInvalidChangedPath() { if (!self::TEST) { throw new PathException(''); } File::changed(self::BASE . '/invalid.txt'); } /** * @expectedException \phpOMS\System\File\PathException */ public function testInvalidSizePath() { if (!self::TEST) { throw new PathException(''); } File::size(self::BASE . '/invalid.txt'); } /** * @expectedException \phpOMS\System\File\PathException */ public function testInvalidPermissionPath() { if (!self::TEST) { throw new PathException(''); } File::permission(self::BASE . '/invalid.txt'); } /** * @expectedException \phpOMS\System\File\PathException */ public function testInvalidOwnerPath() { if (!self::TEST) { throw new PathException(''); } File::owner(self::BASE . '/invalid.txt'); } }