Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
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
(
$uuid
,
new
MySQLPlatform
(
)
)
;
$this
->
assertEquals
(
'foo',
$actual
)
;
}
public
function
testUuidStringConvertsToDatabaseValue
(
)
{
$actual
=
$this
->type->
convertToDatabaseValue
(
self::DUMMY_UUID,
new
PostgreSQLPlatform
(
)
)
;
$this
->
assertEquals
(
self::DUMMY_UUID,
$actual
)
;
}