コード例 #1
0
 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);
     }
 }
コード例 #2
0
 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);
 }
コード例 #3
0
ファイル: IsInstanceOf.php プロジェクト: cruni505/prestomed
 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;
 }
コード例 #4
0
 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));
     }
 }
コード例 #5
0
 /**
  * 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++;
     }
 }
コード例 #6
0
ファイル: Set.php プロジェクト: EnmanuelCode/backend-laravel
 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);
     }
 }
コード例 #7
0
ファイル: IsEqual.php プロジェクト: ngitimfoyo/Nyari-AppPHP
 public function describeTo(Description $description)
 {
     $description->appendValue($this->_item);
 }
コード例 #8
0
 public function describeTo(Description $description)
 {
     $description->appendText('null');
 }
コード例 #9
0
 public function describeTo(Description $description)
 {
     $description->appendDescriptionOf($this->_matcher);
 }
コード例 #10
0
 public function describeTo(Description $description)
 {
     $description->appendText($this->_empty ? 'an empty traversable' : 'a non-empty traversable');
 }
コード例 #11
0
 public function describeTo(Description $description)
 {
     $description->appendList('[', ', ', ']', $this->_elementMatchers)->appendText(' in any order');
 }
コード例 #12
0
 public function describeTo(Description $description)
 {
     $description->appendList('[', ', ', ']', $this->_elementMatchers);
 }
コード例 #13
0
 protected function describeMismatchSafely($item, Description $mismatchDescription)
 {
     $mismatchDescription->appendText('was ')->appendText($item);
 }
コード例 #14
0
 public function describeTo(Description $description)
 {
     $description->appendText('an instance of ')->appendText($this->_theClass);
 }
コード例 #15
0
 public function describeTo(Description $description)
 {
     $description->appendText('every item is ')->appendDescriptionOf($this->_matcher);
 }
コード例 #16
0
 public function describeTo(Description $description)
 {
     $description->appendText('a string ')->appendText($this->relationship())->appendText(' ')->appendValue($this->_substring);
 }
コード例 #17
0
ファイル: IsCloseTo.php プロジェクト: cruni505/prestomed
 protected function describeMismatchSafely($item, Description $mismatchDescription)
 {
     $mismatchDescription->appendValue($item)->appendText(' differed by ')->appendValue($this->_actualDelta($item));
 }
コード例 #18
0
 public function describeTo(Description $description)
 {
     $description->appendText('equalToIgnoringWhiteSpace(')->appendValue($this->_string)->appendText(')');
 }
コード例 #19
0
 protected function describeCollectionType(Description $description)
 {
     $description->appendText("any");
 }
コード例 #20
0
 public function describeTo(Description $description)
 {
     $description->appendText('array containing [')->appendDescriptionOf($this->_keyMatcher)->appendText(' => ')->appendDescriptionOf($this->_valueMatcher)->appendText(']');
 }
コード例 #21
0
ファイル: HasXPath.php プロジェクト: cruni505/prestomed
 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);
     }
 }
コード例 #22
0
 public function describeTo(Description $description)
 {
     $description->appendText('array with key ')->appendDescriptionOf($this->_keyMatcher);
 }
コード例 #23
0
 public function describeTo(Description $description)
 {
     $description->appendText('a collection containing ')->appendDescriptionOf($this->_elementMatcher);
 }
コード例 #24
0
ファイル: IsArray.php プロジェクト: cruni505/prestomed
 public function describeTo(Description $description)
 {
     $description->appendList($this->descriptionStart(), $this->descriptionSeparator(), $this->descriptionEnd(), $this->_elementMatchers);
 }
コード例 #25
0
 public function describeTo(Description $description)
 {
     $description->appendText('sameInstance(')->appendValue($this->_object)->appendText(')');
 }
コード例 #26
0
 public function describeTo(\Hamcrest\Description $description)
 {
     $description->appendText('SOME DESCRIPTION');
 }
コード例 #27
0
 public function describeTo(Description $description)
 {
     $description->appendText('a numeric value within ')->appendValue($this->_delta)->appendText(' of ')->appendValue($this->_value);
 }
コード例 #28
0
 public function describeTo(Description $description)
 {
     $description->appendText('a string containing ')->appendValueList('', ', ', '', $this->_substrings)->appendText(' in order');
 }
コード例 #29
0
 public function describeToWithOperator(Description $description, $operator)
 {
     $description->appendList('(', ' ' . $operator . ' ', ')', $this->_matchers);
 }
コード例 #30
0
 public function describeTo(Description $description)
 {
     $description->appendText($this->_empty ? 'an empty string' : 'a non-empty string');
 }