本文整理汇总了PHP中Hamcrest\Description类的典型用法代码示例。如果您正苦于以下问题:PHP Description类的具体用法?PHP Description怎么用?PHP Description使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Description类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: describeTo
public function describeTo(Description $description)
{
$description->appendText('a string ')->appendText($this->relationship())->appendText(' ')->appendValue($this->_substring);
}
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:4,代码来源:SubstringMatcher.php
示例17: describeMismatchSafely
protected function describeMismatchSafely($item, Description $mismatchDescription)
{
$mismatchDescription->appendValue($item)->appendText(' differed by ')->appendValue($this->_actualDelta($item));
}
开发者ID:cruni505,项目名称:prestomed,代码行数:4,代码来源:IsCloseTo.php
示例18: describeTo
public function describeTo(Description $description)
{
$description->appendText('equalToIgnoringWhiteSpace(')->appendValue($this->_string)->appendText(')');
}
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:4,代码来源:IsEqualIgnoringWhiteSpace.php
示例19: describeCollectionType
protected function describeCollectionType(Description $description)
{
$description->appendText("any");
}
开发者ID:fcm,项目名称:GovernorFramework,代码行数:4,代码来源:ListWithAnyOfMatcher.php
示例20: describeTo
public function describeTo(Description $description)
{
$description->appendText('array containing [')->appendDescriptionOf($this->_keyMatcher)->appendText(' => ')->appendDescriptionOf($this->_valueMatcher)->appendText(']');
}
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:4,代码来源:IsArrayContainingKeyValuePair.php
注:本文中的Hamcrest\Description类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论