Ejemplo n.º 1
0
 /**
  * test epObject::epMatches()
  */
 public function testObjectMatch()
 {
     // make an eptTest object
     $this->assertTrue($o = new eptTest("XXX", "YYY", "ZZZ"));
     // wrap it with epObject
     $this->assertTrue($w = new epObject($o));
     // make an eptTest object
     $this->assertTrue($p = new eptTest("XXX", "YYY", "ZZZ"));
     // wrap it
     $this->assertTrue($m = new epObject($p));
     // copy vars over from $w
     $m->epCopyVars($w);
     // should match with the copy
     $this->assertTrue($w->epMatches($m));
     // set vars in m to null, should still match (because null vars are ignored)
     $this->assertTrue($vars = $m->epGetVars());
     foreach ($vars as $var => $value) {
         // skip oid
         if ($var == 'oid') {
             continue;
         }
         $m->epSet($var, null);
         $this->assertTrue($w->epMatches($m));
     }
     // set vars to diff values, assert no match
     foreach ($vars as $var => $value) {
         if (is_string($value)) {
             $m->epSet($var, md5($w->epGet($var)));
             $this->assertFalse($w->epMatches($m));
         }
     }
 }