Ejemplo n.º 1
0
 public function testUpdatePropsForbidden()
 {
     $propPatch = new PropPatch(array(self::OWNER_ID_PROPERTYNAME => 'user2', self::OWNER_DISPLAY_NAME_PROPERTYNAME => 'User Two', self::FILEID_PROPERTYNAME => 12345, self::PERMISSIONS_PROPERTYNAME => 'C', self::SIZE_PROPERTYNAME => 123, self::DOWNLOADURL_PROPERTYNAME => 'http://example.com/'));
     $this->plugin->handleUpdateProperties('/dummypath', $propPatch);
     $propPatch->commit();
     $this->assertEmpty($propPatch->getRemainingMutations());
     $result = $propPatch->getResult();
     $this->assertEquals(403, $result[self::OWNER_ID_PROPERTYNAME]);
     $this->assertEquals(403, $result[self::OWNER_DISPLAY_NAME_PROPERTYNAME]);
     $this->assertEquals(403, $result[self::FILEID_PROPERTYNAME]);
     $this->assertEquals(403, $result[self::PERMISSIONS_PROPERTYNAME]);
     $this->assertEquals(403, $result[self::SIZE_PROPERTYNAME]);
     $this->assertEquals(403, $result[self::DOWNLOADURL_PROPERTYNAME]);
 }
Ejemplo n.º 2
0
 public function testUpdateProps()
 {
     $node = $this->createTestNode('\\OCA\\DAV\\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::LASTMODIFIED_PROPERTYNAME => $testDate));
     $this->plugin->handleUpdateProperties('/dummypath', $propPatch);
     $propPatch->commit();
     $this->assertEmpty($propPatch->getRemainingMutations());
     $result = $propPatch->getResult();
     $this->assertEquals(200, $result[self::LASTMODIFIED_PROPERTYNAME]);
     $this->assertEquals(200, $result[self::GETETAG_PROPERTYNAME]);
 }