Exemple #1
0
 /**
  * Funky test as float values get rounded when you clip digits and recreate
  * them so what we're doing is verifying the float that is regenerated
  * from the object results in the same 16 digit integer.
  */
 public function testToFloat()
 {
     $i = $this->testCount;
     do {
         $microtime = microtime(true);
         $m = Microtime::fromFloat($microtime);
         $f1 = substr(str_pad(str_replace('.', '', $microtime), 16, '0'), 0, 16);
         $f2 = substr(str_pad(str_replace('.', '', $m->toFloat()), 16, '0'), 0, 16);
         $this->assertSame($f1, $f2);
         --$i;
     } while ($i > 0);
 }
Exemple #2
0
 /**
  * {@inheritdoc}
  */
 public function getDefault()
 {
     return Microtime::create();
 }
Exemple #3
0
 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()];
 }