/**
  * @covers W3C\Formatter\Checkstyle::format
  */
 public function testFormatAddsWarningViolations()
 {
     $formatter = $this->getMock('W3C\\Formatter\\Checkstyle', array('addViolation'));
     $result = new Result();
     $warning1 = new Violation();
     $warning2 = new Violation();
     $result->addWarning($warning1)->addWarning($warning2);
     $formatter->expects($this->at(0))->method('addViolation')->with($this->anything(), $this->identicalTo($warning1), 'warning');
     $formatter->expects($this->at(1))->method('addViolation')->with($this->anything(), $this->identicalTo($warning2), 'warning');
     $formatter->format($result);
 }
 /**
  * Parses the SOAP response of the API and returns a new Result object.
  *
  * @param string $response SOAP response of the API
  * @return Result
  */
 protected function parseResponse($response)
 {
     $xml = new SimpleXMLElement($response);
     $ns = $xml->getNamespaces(true);
     $data = $xml->children($ns['env'])->children($ns['m'])->markupvalidationresponse;
     $result = new Result();
     $result->setIsValid($data->validity == 'true');
     foreach ($data->errors->errorlist->error as $error) {
         $entry = $this->getEntry($error);
         $result->addError($entry);
     }
     foreach ($data->warnings->warninglist->warning as $warning) {
         if (strpos($warning->messageid, 'W') === false) {
             $entry = $this->getEntry($warning);
             $result->addWarning($entry);
         }
     }
     return $result;
 }