public function testUpdateFav()
 {
     // this test will replace the existing tags "tagremove" with "tag1" and "tag2"
     // and keep "tagkeep"
     $node = $this->getMockBuilder('\\OC_Connector_Sabre_Node')->disableOriginalConstructor()->getMock();
     $node->expects($this->any())->method('getId')->will($this->returnValue(123));
     // set favorite tag
     $this->tagger->expects($this->once())->method('tagAs')->with(123, self::TAG_FAVORITE);
     // properties to set
     $properties = array(self::FAVORITE_PROPERTYNAME => true);
     $result = array();
     $this->plugin->updateProperties($properties, $result, $node);
     // all requested properties removed, as they were processed already
     $this->assertEmpty($properties);
     $this->assertTrue($result[200][self::FAVORITE_PROPERTYNAME]);
     $this->assertFalse(isset($result[200][self::TAGS_PROPERTYNAME]));
     // unfavorite now
     // set favorite tag
     $this->tagger->expects($this->once())->method('unTag')->with(123, self::TAG_FAVORITE);
     $properties = array(self::FAVORITE_PROPERTYNAME => false);
     $result = array();
     $this->plugin->updateProperties($properties, $result, $node);
     $this->assertFalse($result[200][self::FAVORITE_PROPERTYNAME]);
     $this->assertFalse(isset($result[200][self::TAGS_PROPERTYNAME]));
 }
 public function testUpdateFav()
 {
     // this test will replace the existing tags "tagremove" with "tag1" and "tag2"
     // and keep "tagkeep"
     $node = $this->getMockBuilder('\\OCA\\DAV\\Connector\\Sabre\\Node')->disableOriginalConstructor()->getMock();
     $node->expects($this->any())->method('getId')->will($this->returnValue(123));
     $this->tree->expects($this->any())->method('getNodeForPath')->with('/dummypath')->will($this->returnValue($node));
     // set favorite tag
     $this->tagger->expects($this->once())->method('tagAs')->with(123, self::TAG_FAVORITE);
     // properties to set
     $propPatch = new \Sabre\DAV\PropPatch(array(self::FAVORITE_PROPERTYNAME => true));
     $this->plugin->handleUpdateProperties('/dummypath', $propPatch);
     $propPatch->commit();
     // all requested properties removed, as they were processed already
     $this->assertEmpty($propPatch->getRemainingMutations());
     $result = $propPatch->getResult();
     $this->assertFalse(false, isset($result[self::TAGS_PROPERTYNAME]));
     $this->assertEquals(200, isset($result[self::FAVORITE_PROPERTYNAME]));
     // unfavorite now
     // set favorite tag
     $this->tagger->expects($this->once())->method('unTag')->with(123, self::TAG_FAVORITE);
     // properties to set
     $propPatch = new \Sabre\DAV\PropPatch(array(self::FAVORITE_PROPERTYNAME => false));
     $this->plugin->handleUpdateProperties('/dummypath', $propPatch);
     $propPatch->commit();
     // all requested properties removed, as they were processed already
     $this->assertEmpty($propPatch->getRemainingMutations());
     $result = $propPatch->getResult();
     $this->assertFalse(false, isset($result[self::TAGS_PROPERTYNAME]));
     $this->assertEquals(200, isset($result[self::FAVORITE_PROPERTYNAME]));
 }