示例#1
0
	public function testUpdateProps() {
		$node = $this->createTestNode('\OC\Connector\Sabre\File');

		$testDate = 'Fri, 13 Feb 2015 00:01:02 GMT';

		$node->expects($this->once())
			->method('touch')
			->with($testDate);

		$node->expects($this->once())
			->method('setEtag')
			->with('newetag')
			->will($this->returnValue(true));

		// properties to set
		$propPatch = new \Sabre\DAV\PropPatch(array(
			self::GETETAG_PROPERTYNAME => 'newetag',
			self::GETLASTMODIFIED_PROPERTYNAME => $testDate
		));

		$this->plugin->handleUpdateProperties(
			'/dummypath',
			$propPatch
		);

		$propPatch->commit();

		$this->assertEmpty($propPatch->getRemainingMutations());

		$result = $propPatch->getResult();
		$this->assertEquals(200, $result[self::GETLASTMODIFIED_PROPERTYNAME]);
		$this->assertEquals(200, $result[self::GETETAG_PROPERTYNAME]);
	}
示例#2
0
 public function testMoveSrcDeletable()
 {
     $fileInfoFolderATestTXT = $this->getMockBuilder('\\OCP\\Files\\FileInfo')->disableOriginalConstructor()->getMock();
     $fileInfoFolderATestTXT->expects($this->once())->method('isDeletable')->willReturn(true);
     $this->view->expects($this->once())->method('getFileInfo')->with('FolderA/test.txt')->willReturn($fileInfoFolderATestTXT);
     $this->plugin->checkMove('FolderA/test.txt', 'test.txt');
 }