public function describeMismatch($item, Description $description) { if ($item === null) { $description->appendText('was null'); } else { $description->appendText('was ')->appendText(self::getTypeDescription(strtolower(gettype($item))))->appendText(' ')->appendValue($item); } }
public function describeTo(Description $description) { $description->appendText('a value ')->appendText($this->_comparison($this->_minCompare)); if ($this->_minCompare != $this->_maxCompare) { $description->appendText(' or ')->appendText($this->_comparison($this->_maxCompare)); } $description->appendText(' ')->appendValue($this->_value); }
protected function matchesWithDiagnosticDescription($item, Description $mismatchDescription) { if (!is_object($item)) { $mismatchDescription->appendText('was ')->appendValue($item); return false; } if (!$item instanceof $this->_theClass) { $mismatchDescription->appendText('[' . get_class($item) . '] ')->appendValue($item); return false; } return true; }
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)); } }
/** * Describe the contents of the given <code>list</code> in the given <code>description</code>. * * @param array $list The list to describe * @param Description $description The description to describe to */ public static function describe(array $list, Description $description) { $counter = 0; $description->appendText("List with "); foreach ($list as $item) { $description->appendText("<")->appendText(null !== $item ? get_class($item) : "null")->appendText(">"); if ($counter === count($list) - 2) { $description->appendText(" and "); } else { if ($counter < count($list) - 2) { $description->appendText(", "); } } $counter++; } }
public function describeMismatch($item, Description $description) { $value = ''; if (!$this->_not) { $description->appendText('was not set'); } else { $property = $this->_property; if (is_array($item)) { $value = $item[$property]; } elseif (is_object($item)) { $value = $item->{$property}; } elseif (is_string($item)) { $value = $item::${$property}; } parent::describeMismatch($value, $description); } }
public function describeTo(Description $description) { $description->appendValue($this->_item); }
public function describeTo(Description $description) { $description->appendText('null'); }
public function describeTo(Description $description) { $description->appendDescriptionOf($this->_matcher); }
public function describeTo(Description $description) { $description->appendText($this->_empty ? 'an empty traversable' : 'a non-empty traversable'); }
public function describeTo(Description $description) { $description->appendList('[', ', ', ']', $this->_elementMatchers)->appendText(' in any order'); }
public function describeTo(Description $description) { $description->appendList('[', ', ', ']', $this->_elementMatchers); }
protected function describeMismatchSafely($item, Description $mismatchDescription) { $mismatchDescription->appendText('was ')->appendText($item); }
public function describeTo(Description $description) { $description->appendText('an instance of ')->appendText($this->_theClass); }
public function describeTo(Description $description) { $description->appendText('every item is ')->appendDescriptionOf($this->_matcher); }
public function describeTo(Description $description) { $description->appendText('a string ')->appendText($this->relationship())->appendText(' ')->appendValue($this->_substring); }
protected function describeMismatchSafely($item, Description $mismatchDescription) { $mismatchDescription->appendValue($item)->appendText(' differed by ')->appendValue($this->_actualDelta($item)); }
public function describeTo(Description $description) { $description->appendText('equalToIgnoringWhiteSpace(')->appendValue($this->_string)->appendText(')'); }
protected function describeCollectionType(Description $description) { $description->appendText("any"); }
public function describeTo(Description $description) { $description->appendText('array containing [')->appendDescriptionOf($this->_keyMatcher)->appendText(' => ')->appendDescriptionOf($this->_valueMatcher)->appendText(']'); }
public function describeTo(Description $description) { $description->appendText('XML or HTML document with XPath "')->appendText($this->_xpath)->appendText('"'); if ($this->_matcher !== null) { $description->appendText(' '); $this->_matcher->describeTo($description); } }
public function describeTo(Description $description) { $description->appendText('array with key ')->appendDescriptionOf($this->_keyMatcher); }
public function describeTo(Description $description) { $description->appendText('a collection containing ')->appendDescriptionOf($this->_elementMatcher); }
public function describeTo(Description $description) { $description->appendList($this->descriptionStart(), $this->descriptionSeparator(), $this->descriptionEnd(), $this->_elementMatchers); }
public function describeTo(Description $description) { $description->appendText('sameInstance(')->appendValue($this->_object)->appendText(')'); }
public function describeTo(\Hamcrest\Description $description) { $description->appendText('SOME DESCRIPTION'); }
public function describeTo(Description $description) { $description->appendText('a numeric value within ')->appendValue($this->_delta)->appendText(' of ')->appendValue($this->_value); }
public function describeTo(Description $description) { $description->appendText('a string containing ')->appendValueList('', ', ', '', $this->_substrings)->appendText(' in order'); }
public function describeToWithOperator(Description $description, $operator) { $description->appendList('(', ' ' . $operator . ' ', ')', $this->_matchers); }
public function describeTo(Description $description) { $description->appendText($this->_empty ? 'an empty string' : 'a non-empty string'); }