當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Hamcrest\Description類代碼示例

本文整理匯總了PHP中Hamcrest\Description的典型用法代碼示例。如果您正苦於以下問題:PHP Description類的具體用法?PHP Description怎麽用?PHP Description使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Description類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: describeMismatch

 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);
     }
 }
開發者ID:EnmanuelCode,項目名稱:backend-laravel,代碼行數:8,代碼來源:IsTypeOf.php

示例2: describeTo

 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);
 }
開發者ID:EnmanuelCode,項目名稱:backend-laravel,代碼行數:8,代碼來源:OrderingComparison.php

示例3: matchesWithDiagnosticDescription

 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;
 }
開發者ID:cruni505,項目名稱:prestomed,代碼行數:12,代碼來源:IsInstanceOf.php

示例4: describeTo

 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));
     }
 }
開發者ID:Ceciceciceci,項目名稱:MySJSU-Class-Registration,代碼行數:15,代碼來源:DescribedAs.php

示例5: describe

 /**
  * 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++;
     }
 }
開發者ID:fcm,項目名稱:GovernorFramework,代碼行數:22,代碼來源:DescriptionUtils.php

示例6: describeMismatch

 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);
     }
 }
開發者ID:EnmanuelCode,項目名稱:backend-laravel,代碼行數:17,代碼來源:Set.php

示例7: describeTo

 public function describeTo(Description $description)
 {
     $description->appendValue($this->_item);
 }
開發者ID:ngitimfoyo,項目名稱:Nyari-AppPHP,代碼行數:4,代碼來源:IsEqual.php

示例8: describeTo

 public function describeTo(Description $description)
 {
     $description->appendText('null');
 }
開發者ID:Ceciceciceci,項目名稱:MySJSU-Class-Registration,代碼行數:4,代碼來源:IsNull.php

示例9: describeTo

 public function describeTo(Description $description)
 {
     $description->appendDescriptionOf($this->_matcher);
 }
開發者ID:EnmanuelCode,項目名稱:backend-laravel,代碼行數:4,代碼來源:CombinableMatcher.php

示例10: describeTo

 public function describeTo(Description $description)
 {
     $description->appendText($this->_empty ? 'an empty traversable' : 'a non-empty traversable');
 }
開發者ID:EnmanuelCode,項目名稱:backend-laravel,代碼行數:4,代碼來源:IsEmptyTraversable.php

示例11: describeTo

 public function describeTo(Description $description)
 {
     $description->appendList('[', ', ', ']', $this->_elementMatchers)->appendText(' in any order');
 }
開發者ID:ngitimfoyo,項目名稱:Nyari-AppPHP,代碼行數:4,代碼來源:IsArrayContainingInAnyOrder.php

示例12: describeTo

 public function describeTo(Description $description)
 {
     $description->appendList('[', ', ', ']', $this->_elementMatchers);
 }
開發者ID:ngitimfoyo,項目名稱:Nyari-AppPHP,代碼行數:4,代碼來源:IsArrayContainingInOrder.php

示例13: describeMismatchSafely

 protected function describeMismatchSafely($item, Description $mismatchDescription)
 {
     $mismatchDescription->appendText('was ')->appendText($item);
 }
開發者ID:cruni505,項目名稱:prestomed,代碼行數:4,代碼來源:IsEqualIgnoringWhiteSpace.php

示例14: describeTo

 public function describeTo(Description $description)
 {
     $description->appendText('an instance of ')->appendText($this->_theClass);
 }
開發者ID:ngitimfoyo,項目名稱:Nyari-AppPHP,代碼行數:4,代碼來源:IsInstanceOf.php

示例15: describeTo

 public function describeTo(Description $description)
 {
     $description->appendText('every item is ')->appendDescriptionOf($this->_matcher);
 }
開發者ID:EnmanuelCode,項目名稱:backend-laravel,代碼行數:4,代碼來源:Every.php


注:本文中的Hamcrest\Description類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。