Ejemplo n.º 1
0
 public function evaluate($other, $description = '', $returnResult = false)
 {
     $isValid = true;
     $comparatorFactory = new Factory();
     $comparatorFactory->register(new DateTimeSimilarComparator());
     $comparatorFactory->register(new DateTimeStringSimilarComparator());
     try {
         $comparator = $comparatorFactory->getComparatorFor($other, $this->value);
         $comparator->assertEquals($this->value, $other, $this->delta, $this->canonicalize, $this->ignoreCase);
     } catch (ComparisonFailure $f) {
         if (!$returnResult) {
             throw new PHPUnit_Framework_ExpectationFailedException(trim($description . "\n" . $f->getMessage()), $f);
         }
         $isValid = false;
     }
     return $isValid;
 }