<?php namespace Hamcrest\Core; /* Copyright (c) 2009 hamcrest.org */ use Hamcrest\BaseMatcher; use Hamcrest\Description; use Hamcrest\Matcher; use Hamcrest\Util; /** * Decorates another Matcher, retaining the behavior but allowing tests * to be slightly more expressive. * * For example: assertThat($cheese, equalTo($smelly)) * vs. assertThat($cheese, is(equalTo($smelly))) */ class Is extends BaseMatcher { private $_matcher; public function __construct(Matcher $matcher) { $this->_matcher = $matcher; } public function matches($arg) { return $this->_matcher->matches($arg); } public function describeTo(Description $description) { $description->appendText('is ')->appendDescriptionOf($this->_matcher); } public function describeMismatch($item, Description $mismatchDescription) { $this->_matcher->describeMismatch($item, $mismatchDescription); } /** * Decorates another Matcher, retaining the behavior but allowing tests * to be slightly more expressive. * * For example: assertThat($cheese, equalTo($smelly)) * vs. assertThat($cheese, is(equalTo($smelly))) * * @factory */ public static function is($value) { return new self(Util::wrapValueWithIsEqual($value)); } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
AllOf.php | File | 1.42 KB | 0644 |
|
AnyOf.php | File | 1.23 KB | 0644 |
|
CombinableMatcher.php | File | 1.74 KB | 0644 |
|
DescribedAs.php | File | 1.81 KB | 0644 |
|
Every.php | File | 1.31 KB | 0644 |
|
HasToString.php | File | 1.24 KB | 0644 |
|
Is.php | File | 1.32 KB | 0644 |
|
IsAnything.php | File | 875 B | 0644 |
|
IsCollectionContaining.php | File | 2.11 KB | 0644 |
|
IsEqual.php | File | 835 B | 0644 |
|
IsIdentical.php | File | 708 B | 0644 |
|
IsInstanceOf.php | File | 1.66 KB | 0644 |
|
IsNot.php | File | 826 B | 0644 |
|
IsNull.php | File | 976 B | 0644 |
|
IsSame.php | File | 1.07 KB | 0644 |
|
IsTypeOf.php | File | 1.64 KB | 0644 |
|
Set.php | File | 2.35 KB | 0644 |
|
ShortcutCombination.php | File | 920 B | 0644 |
|