/**
  * @covers ::describeDOMElement
  */
 public function testDescribeDOMElement()
 {
     $doc = new DOMDocument();
     $doc->loadHTML('
         <div id="test"></div>
         <button id="test2" class="my" type="submit" value="test" disabled></button>
     ');
     $this->assertEquals('div#test', Converter::describeDOMElement($doc->getElementById('test')), 'Describe element with id');
     $this->assertEquals('button#test2.my', Converter::describeDOMElement($doc->getElementById('test2')), 'Describe element with different attributes');
     $this->assertEquals('[unknown]', Converter::describeDOMElement('test'), 'Describe empty element');
 }
 /**
  * Convert a dom element to a textual representation.
  * Shows tag name, id and classes
  *
  * @param  mixed $other
  * @return string
  */
 public static function describeDOMElement($other)
 {
     if ($other instanceof DOMElement) {
         $tag = $other->tagName;
         $id = $other->getAttribute("id");
         $id = $id ? '#' . $id : null;
         $classes = Converter::parseClasses($other->getAttribute("class"));
         $classes = $classes ? '.' . join('.', $classes) : null;
         return $tag . $id . $classes;
     } else {
         return '[unknown]';
     }
 }
 /**
  * Returns the description of the failure
  *
  * The beginning of failure messages is "Failed asserting that" in most
  * cases. This method should return the second part of that sentence.
  *
  * This works specifically to make a nice representation of a DOMElement
  *
  * @param  mixed  $other Evaluated value or object.
  * @return string
  */
 protected function failureDescription($other)
 {
     return Converter::describeDOMElement($other) . ' ' . $this->toString();
 }