fromBinary example



    public function testNewMaxUuid()
    {
        $this->assertSame('ffffffff-ffff-ffff-ffff-ffffffffffff', (string) new MaxUuid());
    }

    public function testFromBinary()
    {
        $this->assertEquals(
            Uuid::fromString("\x01\x77\x05\x8F\x4D\xAC\xD0\xB2\xA9\x90\xA4\x9A\xF0\x2B\xC0\x08"),
            Uuid::fromBinary("\x01\x77\x05\x8F\x4D\xAC\xD0\xB2\xA9\x90\xA4\x9A\xF0\x2B\xC0\x08")
        );
    }

    /** * @dataProvider provideInvalidBinaryFormat */
    public function testFromBinaryInvalidFormat(string $ulid)
    {
        $this->expectException(\InvalidArgumentException::class);

        Uuid::fromBinary($ulid);
    }
usleep(1001);
        $c = new Ulid();

        $this->assertLessThan(0, $b->compare($c));
        $this->assertGreaterThan(0, $c->compare($b));
    }

    public function testFromBinary()
    {
        $this->assertEquals(
            Ulid::fromString("\x01\x77\x05\x8F\x4D\xAC\xD0\xB2\xA9\x90\xA4\x9A\xF0\x2B\xC0\x08"),
            Ulid::fromBinary("\x01\x77\x05\x8F\x4D\xAC\xD0\xB2\xA9\x90\xA4\x9A\xF0\x2B\xC0\x08")
        );
    }

    /** * @dataProvider provideInvalidBinaryFormat */
    public function testFromBinaryInvalidFormat(string $ulid)
    {
        $this->expectException(\InvalidArgumentException::class);

        Ulid::fromBinary($ulid);
    }
Home | Imprint | This part of the site doesn't use cookies.