Example #1
0
 public function testUpdate()
 {
     $node_a = new Node();
     $node_a->setIdHexStr('11111111-1111-4111-8111-111111111100');
     $node_a->setUri('tcp://192.168.241.24:25000');
     $node_b = new Node();
     $node_b->setIdHexStr('11111111-1111-4111-8111-111111111101');
     $node_b->setUri('tcp://192.168.241.25:25000');
     $node_b->setBridgeServer(true);
     $node_b->setBridgeClient(true);
     $node_a->update($node_b);
     $this->assertEquals('11111111-1111-4111-8111-111111111100', $node_a->getIdHexStr());
     $this->assertEquals('tcp://192.168.241.24:25000', (string) $node_a->getUri());
     $this->assertFalse($node_a->getBridgeServer());
     $this->assertFalse($node_a->getBridgeClient());
     $this->assertFalse($node_a->getDataChanged());
     $node_b->setTimeLastSeen(time());
     $node_a->update($node_b);
     $this->assertEquals('11111111-1111-4111-8111-111111111100', $node_a->getIdHexStr());
     $this->assertEquals('tcp://192.168.241.25:25000', (string) $node_a->getUri());
     $this->assertTrue($node_a->getBridgeServer());
     $this->assertTrue($node_a->getBridgeClient());
     $this->assertTrue($node_a->getDataChanged());
 }