/** * @covers Object_Struct::equals */ public function testEquals() { $this->assertFalse($this->object->equals($this)); $this->assertFalse($this->object->equals(new Object_Struct())); $this->assertFalse($this->object->equals(new Object_Struct_for_Test1())); $this->assertTrue($this->object->equals($this->object)); }
/** * Сравнивает два объекта Object_Struct * * @param Object_Struct $with Объект, с которым сравнивается текущий. * * @return boolean */ public function equals($with) { if (!$with instanceof Object_Struct || !Core::equals($p = $this->get_properties(), $with->get_properties())) { return false; } foreach ($p as $v) { if (!Core::equals($this->{$v}, $with->{$v})) { return false; } } return true; }