protected function describeMismatchSafely($array, Description $mismatchDescription)
 {
     //Not using appendValueList() so that keys can be shown
     $mismatchDescription->appendText('array was ')->appendText('[');
     $loop = false;
     foreach ($array as $key => $value) {
         if ($loop) {
             $mismatchDescription->appendText(', ');
         }
         $mismatchDescription->appendValue($key)->appendText(' => ')->appendValue($value);
         $loop = true;
     }
     $mismatchDescription->appendText(']');
 }
 public function describeTo(Description $description)
 {
     $textStart = 0;
     while (preg_match(self::ARG_PATTERN, $this->_descriptionTemplate, $matches, PREG_OFFSET_CAPTURE, $textStart)) {
         $text = $matches[0][0];
         $index = $matches[1][0];
         $offset = $matches[0][1];
         $description->appendText(substr($this->_descriptionTemplate, $textStart, $offset - $textStart));
         $description->appendValue($this->_values[$index]);
         $textStart = $offset + strlen($text);
     }
     if ($textStart < strlen($this->_descriptionTemplate)) {
         $description->appendText(substr($this->_descriptionTemplate, $textStart));
     }
 }
 protected function describeMismatchSafely($item, Description $mismatchDescription)
 {
     $mismatchDescription->appendValue($item)->appendText(' differed by ')->appendValue($this->_actualDelta($item));
 }
Beispiel #4
0
 public function describeTo(Description $description)
 {
     $description->appendValue($this->_item);
 }
 protected function describeMismatchSafely($item, Description $mismatchDescription)
 {
     $mismatchDescription->appendValue($item)->appendText(' was ')->appendText($this->_comparison($this->_compare($this->_value, $item)))->appendText(' ')->appendValue($this->_value);
 }
Beispiel #6
0
 public function describeTo(Description $description)
 {
     $description->appendValue($this->toString());
 }