コード例 #1
0
 public function testGenerate()
 {
     $id = TimeUuidIdentifier::generate();
     $this->assertTrue(Uuid::isValid($id));
     $uuid = Uuid::fromString($id->toString());
     $this->assertTrue($uuid->getVersion() == 1);
 }
コード例 #2
0
ファイル: TimeUuidType.php プロジェクト: gdbots/pbj
 /**
  * {@inheritdoc}
  */
 public function getDefault()
 {
     return TimeUuidIdentifier::generate();
 }
コード例 #3
0
ファイル: AddTypesTest.php プロジェクト: gdbots/pbj-php
 protected function getTypeValues()
 {
     return ['BigInt' => [new BigNumber(0), new BigNumber('18446744073709551615')], 'Binary' => 'aG9tZXIgc2ltcHNvbg==', 'Blob' => 'aG9tZXIgc2ltcHNvbg==', 'Boolean' => [false, true], 'Date' => new \DateTime(), 'DateTime' => new \DateTime(), 'Decimal' => 3.14, 'DynamicField' => DynamicField::createIntVal('int_val', 1), 'Float' => 13213.032468, 'GeoPoint' => new GeoPoint(0.5, 102.0), 'IntEnum' => IntEnum::UNKNOWN(), 'Int' => [0, 4294967295], 'MediumInt' => [0, 16777215], 'MediumBlob' => 'aG9tZXIgc2ltcHNvbg==', 'MediumText' => 'medium text', 'Message' => NestedMessage::create(), 'MessageRef' => new MessageRef(NestedMessage::schema()->getCurie(), UuidIdentifier::generate()), 'Microtime' => Microtime::create(), 'SignedBigInt' => [new BigNumber('-9223372036854775808'), new BigNumber('9223372036854775807')], 'SignedMediumInt' => [-8388608, 8388607], 'SignedSmallInt' => [-32768, 32767], 'SignedTinyInt' => [-128, 127], 'SmallInt' => [0, 65535], 'StringEnum' => StringEnum::UNKNOWN(), 'String' => 'string', 'Text' => 'text', 'TimeUuid' => TimeUuidIdentifier::generate(), 'Timestamp' => time(), 'TinyInt' => [0, 255], 'Uuid' => UuidIdentifier::generate()];
 }