Example #1
0
	public function testCopyTo() {
		$file = new \Core\Filestore\Backends\FileRemote($this->_testfile);

		// I should be able to copy to a filename.
		// this gets resolved to a local file.
		$copy = $file->copyTo('tmp/tests-fileremotetest-testcopyto.dat');
		$this->assertInstanceOf('\\Core\\Filestore\\File', $copy);
		$this->assertTrue($copy->exists());
		$this->assertTrue($copy->delete());

		// And it should be able to copy to a local file object.
		$copy = new \Core\Filestore\Backends\FileLocal('tmp/tests-fileremotetest-testcopyto.dat');
		$this->assertFalse($copy->exists());
		$file->copyTo($copy);
		$this->assertTrue($copy->exists());
		$this->assertTrue($copy->delete());
	}
Example #2
0
	public function testExists() {
		$file1 = new \Core\Filestore\Backends\FileLocal('core/tests/updater-testdocument.txt');
		$file2 = new \Core\Filestore\Backends\FileLocal('core/tests/updater-testdocument-doesntoexist.txt');

		$this->assertTrue($file1->exists());
		$this->assertFalse($file2->exists());
	}
Example #3
0
	public function testCopyTo() {
		if(!$this->_ftp) $this->markTestSkipped('FTP disabled, skipping tests');

		$file = new \Core\Filestore\Backends\FileFTP('core/tests/updater-testdocument.txt');

		// I should be able to copy to a filename.
		// this gets resolved to a local file.
		$copy = $file->copyTo('tmp/tests-fileremotetest-testcopyto.dat');
		$this->assertInstanceOf('\\Core\\Filestore\\File', $copy);
		$this->assertTrue($copy->exists());
		$this->assertTrue($copy->delete());

		// And it should be able to copy to a local file object.
		$copy = new \Core\Filestore\Backends\FileLocal('tmp/tests-fileremotetest-testcopyto.dat');
		$this->assertFalse($copy->exists());
		$file->copyTo($copy);
		$this->assertTrue($copy->exists());
		$this->assertTrue($copy->delete());
	}