/**
  * @test
  */
 public function canDeleteStopword()
 {
     //$this->markTestIncomplete('Process error');
     $this->stopwordBackend = $this->getMock('\\Searchperience\\Api\\Client\\System\\Storage\\RestStopwordBackend', array('deleteByWord'));
     $this->stopwordBackend->injectDateTimeService(new \Searchperience\Api\Client\System\DateTime\DateTimeService());
     $restClient = new \Guzzle\Http\Client('http://api.searchperience.com/');
     $mock = new \Guzzle\Plugin\Mock\MockPlugin();
     $mock->addResponse(new \Guzzle\Http\Message\Response(201));
     $restClient->addSubscriber($mock);
     $this->stopwordBackend->injectRestClient($restClient);
     $this->stopwordBackend->expects($this->once())->method('deleteByWord')->with('one', 'foo')->will($this->returnValue($this->getMock('\\Guzzle\\Http\\Message\\Response', array(), array(), '', false)));
     $stopword = new Stopword();
     $stopword->setWord('foo');
     $stopword->setTagName('one');
     $this->stopwordBackend->delete('one', $stopword);
 }
 /**
  * @param \SimpleXMLElement $xml
  * @return \Searchperience\Api\Client\Domain\Stopword\StopwordCollection
  */
 protected function buildStopwordsFromXml(\SimpleXMLElement $xml)
 {
     $stopwordCollection = new StopwordCollection();
     if ($xml->totalCount instanceof \SimpleXMLElement) {
         $stopwordCollection->setTotalCount((int) $xml->totalCount->__toString());
     }
     $stopwords = $xml->xpath('stopword');
     foreach ($stopwords as $stopword) {
         $stopwordAttributeArray = (array) $stopword->attributes();
         $stopwordObject = new Stopword();
         $stopwordObject->__setProperty('word', (string) $stopwordAttributeArray['@attributes']['word']);
         $stopwordObject->__setProperty('tagName', (string) $stopwordAttributeArray['@attributes']['tag']);
         $stopwordCollection->append($stopwordObject);
     }
     return $stopwordCollection;
 }
 /**
  * Delete a stopword from the api.
  * @param Stopword $stopword
  * @return mixed
  */
 public function delete(Stopword $stopword)
 {
     return $this->deleteByWord($stopword->getWord(), $stopword->getTagName());
 }
 /**
  * @test
  */
 public function canSetTagName()
 {
     $this->stopword->setTagName("en");
     $this->assertSame("en", $this->stopword->getTagName());
 }