/**
  * @see Comparable::equals
  *
  * @param DiffRangeConstraint $constraint
  * @return boolean
  */
 public function equals($constraint)
 {
     if ($constraint === $this) {
         return true;
     }
     if (!$constraint instanceof self) {
         return false;
     }
     return $this->diff->equals($constraint->diff);
 }
 /**
  * @see DataValueChecker::checkDataValue
  *
  * @param DataValue $dataValue
  * @return boolean
  */
 public function checkDataValue(DataValue $dataValue)
 {
     foreach ($this->values as $value) {
         if ($dataValue->equals($value)) {
             return true;
         }
     }
     return false;
 }
 /**
  * @see Comparable::equals
  *
  * @param RangeChecker $constraint
  * @return boolean
  */
 public function equals($constraint)
 {
     if ($constraint === $this) {
         return true;
     }
     if (!$constraint instanceof self) {
         return false;
     }
     return $this->minValue->equals($constraint->minValue) && $this->maxValue->equals($constraint->maxValue);
 }
 /**
  * @param DataValue|mixed $expected
  * @param DataValue|mixed $actual
  */
 private function assertSmartEquals($expected, $actual)
 {
     if ($this->requireDataValue() || $expected instanceof Comparable) {
         if ($expected instanceof DataValue && $actual instanceof DataValue) {
             $msg = "testing equals():\n" . preg_replace('/\\s+/', ' ', print_r($actual->toArray(), true)) . " should equal\n" . preg_replace('/\\s+/', ' ', print_r($expected->toArray(), true));
         } else {
             $msg = 'testing equals()';
         }
         $this->assertTrue($expected->equals($actual), $msg);
     } else {
         $this->assertEquals($expected, $actual);
     }
 }
Beispiel #5
0
 /**
  * @see Comparable::equals
  *
  * @since 1.0
  *
  * @param mixed $mixed
  *
  * @return boolean
  */
 public function equals($mixed)
 {
     return $mixed instanceof SomeProperty && $this->isSubProperty === $mixed->isSubProperty() && $this->propertyId->equals($mixed->getPropertyId()) && $this->subDescription->equals($mixed->getSubDescription());
 }
 /**
  * @see Comparable::equals
  *
  * @since 1.0
  *
  * @param mixed $mixed
  *
  * @return boolean
  */
 public function equals($mixed)
 {
     return $mixed instanceof PropertySelection && $this->propertyId->equals($mixed->getPropertyId());
 }
 /**
  * @dataProvider instanceProvider
  * @param DataValue $value
  * @param array $arguments
  */
 public function testGetCopy(DataValue $value, array $arguments)
 {
     $copy = $value->getCopy();
     $this->assertInstanceOf('\\DataValues\\DataValue', $copy);
     $this->assertTrue($value->equals($copy));
 }
 /**
  * @see Comparable::equals
  *
  * @since 1.0
  *
  * @param mixed $mixed
  *
  * @return boolean
  */
 public function equals($mixed)
 {
     return $mixed instanceof ValueDescription && $this->comparator === $mixed->getComparator() && $this->value->equals($mixed->getValue());
 }