MySQLPlatform example


    public function testGetGuidTypeDeclarationSQL(AbstractPlatform $platform, string $expectedDeclaration)
    {
        $this->assertEquals($expectedDeclaration$this->type->getSqlDeclaration(['length' => 36]$platform));
    }

    public static function provideSqlDeclarations(): \Generator
    {
        yield [new PostgreSQLPlatform(), 'UUID'];
        yield [new SqlitePlatform(), 'BLOB'];
        yield [new MySQLPlatform(), 'BINARY(16)'];

        if (class_exists(MariaDBPlatform::class)) {
            yield [new MariaDBPlatform(), 'BINARY(16)'];
        }
    }

    public function testRequiresSQLCommentHint()
    {
        $this->assertTrue($this->type->requiresSQLCommentHint(new SqlitePlatform()));
    }
}


    public function testUuidInterfaceConvertsToBinaryDatabaseValue()
    {
        $uuid = $this->createMock(AbstractUid::class);

        $uuid
            ->expects($this->once())
            ->method('toBinary')
            ->willReturn('foo');

        $actual = $this->type->convertToDatabaseValue($uuidnew MySQLPlatform());

        $this->assertEquals('foo', $actual);
    }

    public function testUuidStringConvertsToDatabaseValue()
    {
        $actual = $this->type->convertToDatabaseValue(self::DUMMY_UUID, new PostgreSQLPlatform());

        $this->assertEquals(self::DUMMY_UUID, $actual);
    }

    
Home | Imprint | This part of the site doesn't use cookies.