Пример #1
0
 public function assertMismatchDescription($expected, \Hamcrest\Matcher $matcher, $arg)
 {
     $description = new \Hamcrest\StringDescription();
     $this->assertFalse($matcher->matches($arg), 'Precondtion: Matcher should not match item');
     $matcher->describeMismatch($arg, $description);
     $this->assertEquals($expected, (string) $description, 'Expected mismatch description');
 }
Пример #2
0
 /**
  * Matches if the result of the XPath expression matches the configured
  * matcher or evaluates to <code>true</code> if there is none.
  *
  * @param mixed $result result of the XPath expression
  * @param Description $mismatchDescription
  * @return bool
  */
 protected function matchesExpression($result, Description $mismatchDescription)
 {
     if ($this->_matcher === null) {
         if ($result) {
             return true;
         }
         $mismatchDescription->appendText('XPath expression result was ')->appendValue($result);
     } else {
         if ($this->_matcher->matches($result)) {
             return true;
         }
         $mismatchDescription->appendText('XPath expression result ');
         $this->_matcher->describeMismatch($result, $mismatchDescription);
     }
     return false;
 }
 private function _describeMismatch(Matcher $matcher, $item)
 {
     $this->_mismatchDescription->appendText('item with key ' . $this->_nextMatchKey . ': ');
     $matcher->describeMismatch($item, $this->_mismatchDescription);
 }