Ejemplo n.º 1
0
 /**
  * Returns a copy of $items where each non-Matcher item is replaced by
  * a Hamcrest_Core_IsEqual matcher for the item. If the first and only item
  * is an array, it is used as the $items array to support the old style
  * of passing an array as the sole argument to a matcher.
  *
  * @param array $items contains items and matchers
  * @return array all items are Hamcrest_Matchers
  */
 public static function createMatcherArray(array $items)
 {
     //Extract single array item
     if (count($items) == 1 && is_array($items[0])) {
         $items = $items[0];
     }
     //Replace non-matchers
     foreach ($items as &$item) {
         if (!$item instanceof Hamcrest_Matcher) {
             $item = Hamcrest_Core_IsEqual::equalTo($item);
         }
     }
     return $items;
 }
Ejemplo n.º 2
0
 protected function createMatcher()
 {
     return Hamcrest_Core_IsEqual::equalTo('irrelevant');
 }
Ejemplo n.º 3
0
/**
 * Is the value equal to another value, as tested by the use of the "=="
 * comparison operator?
 */
function equalTo($item)
{
    require_once 'Hamcrest/Core/IsEqual.php';
    return Hamcrest_Core_IsEqual::equalTo($item);
}