/** * Event constructor. Get an UUID for the event. * * @since 0.1.0 * @return void */ public function __construct() { $this->uuid = Uuid::getUuid(); $now = new \DateTime('now'); $now->setTimezone(new \DateTimeZone('UTC')); $timestamp = $now->format('Y-m-d H:i:s'); $this->timestamp = $timestamp; }
function testItUnpacksUuidsFromBinaryForm() { $uuid = Uuid::getUuid(); $packed = Uuid::pack($uuid); $unpacked = Uuid::unpack($packed); $this->assertRegExp('%^[0-9A-Za-z-]+$%', $unpacked); $this->assertEquals($unpacked, $uuid); }