public function testSerialize()
 {
     $s = new Entitlement(array("foo", "bar", "baz"));
     $t = new Entitlement($s->toArray());
     $this->assertTrue($t->equals($s));
 }
 public function equals(Entitlement $that)
 {
     $thisEntitlement = $this->toArray();
     $thatEntitlement = $that->toArray();
     foreach ($thisEntitlement as $s) {
         if (!in_array($s, $thatEntitlement)) {
             return false;
         }
     }
     foreach ($thatEntitlement as $s) {
         if (!in_array($s, $thisEntitlement)) {
             return false;
         }
     }
     return true;
 }