예제 #1
0
파일: StructTest.php 프로젝트: techart/tao
 /**
  * @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));
 }
예제 #2
0
파일: Object.php 프로젝트: techart/tao
 /**
  * Сравнивает два объекта 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;
 }