Example #1
0
 /**
  * @dataProvider nodeClassProvider
  * @expectedException Sabre\DAV\Exception\Conflict
  */
 public function testCreateTagConflict($nodeClass)
 {
     $requestData = json_encode(['name' => 'Test', 'userVisible' => true, 'userAssignable' => false]);
     $node = $this->getMockBuilder($nodeClass)->disableOriginalConstructor()->getMock();
     $this->tagManager->expects($this->once())->method('createTag')->with('Test', true, false)->will($this->throwException(new TagAlreadyExistsException('Tag already exists')));
     $this->tree->expects($this->any())->method('getNodeForPath')->with('/systemtags')->will($this->returnValue($node));
     $request = $this->getMockBuilder('Sabre\\HTTP\\RequestInterface')->disableOriginalConstructor()->getMock();
     $response = $this->getMockBuilder('Sabre\\HTTP\\ResponseInterface')->disableOriginalConstructor()->getMock();
     $request->expects($this->once())->method('getPath')->will($this->returnValue('/systemtags'));
     $request->expects($this->once())->method('getBodyAsString')->will($this->returnValue($requestData));
     $request->expects($this->once())->method('getHeader')->with('Content-Type')->will($this->returnValue('application/json'));
     $this->plugin->httpPost($request, $response);
 }