function testCopyFileToExistingLocation() { mkdir(T_CACHE_DIR . 'test'); $path = $this->getPathObject(T_CACHE_DIR . 'test', 'source', 'txt'); /* create some content in file */ touch($path->__toString()); $file = new T_File_Unlocked($path, 'wb'); $len = $file->write('content'); $file->close(); unset($file); /* create existing alternative */ $alt = $this->getPathObject(T_CACHE_DIR . 'test', 'target', 'txt'); touch($alt->__toString()); $path->copyTo($alt); clearstatcache(); /* assert new file in new location */ $this->assertTrue(is_file(T_CACHE_DIR . 'test/target.txt')); $this->assertTrue(is_file(T_CACHE_DIR . 'test/source.txt')); $file = new T_File_Unlocked($path, 'rb'); $this->assertSame('content', $file->read($len)); $file->close(); unset($file); }