/** * Unserializes the data * * @param array $data data to be unserialized * * @return array unserialized message */ public function unserialize($data) { $mssg = msgpack_unpack($data); //lets just make UUIDs readable incase we need to debug $mssg[0] = Helper::binToUuid($mssg[0]); $mssg[1] = Helper::binToUuid($mssg[1]); return $mssg; }
/** * Testing UUID * * @return void */ public function testCreateUuid() { $uuid1 = Helper::createUuid(); $this->assertTRUE(mb_strlen($uuid1, 'ISO-8859-1') == 36, 'The generated UUID is not the correct length '); $this->assertTRUE(count(str_split($uuid1, 1)) == 36, 'The generated UUID is not the correct length'); $uuid = Helper::uuidToBin($uuid1); $this->assertTRUE(mb_strlen($uuid, 'ISO-8859-1') == 16, 'The conversion to bin of the UUID is not the correct length (16 bytes)'); $this->assertTRUE(count(str_split($uuid, 1)) == 16, 'The conversion to bin of the UUID is not the correct length (16 bytes)'); //test that the bin format is correct for rexPro $this->assertEquals(bin2hex($uuid), str_replace('-', '', trim($uuid1)), 'The conversion to bin of the UUID is incorrect'); $uuid = Helper::binToUuid($uuid); $this->assertTRUE(mb_strlen($uuid, 'ISO-8859-1') == 36, 'The conversion of bin UUID to UUID is not the correct length'); $this->assertTRUE(count(str_split($uuid, 1)) == 36, 'The conversion of bin UUID to UUID is not the correct length'); $this->assertEquals($uuid, $uuid1, 'UUID before and after convertion do not match'); }