Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
createConnectionMock example
$connection
= DriverManager::
getConnection
(
[
'driver' => 'pdo_sqlite', 'path' => self::
$dbFile
]
,
$this
->
getDbalConfig
(
)
)
;
$schema
=
new
Schema
(
)
;
$adapter
=
new
DoctrineDbalAdapter
(
$connection
)
;
$adapter
->
configureSchema
(
$schema
,
$connection
,
fn
(
)
=> true
)
;
$this
->
assertTrue
(
$schema
->
hasTable
(
'cache_items'
)
)
;
}
public
function
testConfigureSchemaDifferentDbalConnection
(
)
{
$otherConnection
=
$this
->
createConnectionMock
(
)
;
$schema
=
new
Schema
(
)
;
$adapter
=
$this
->
createCachePool
(
)
;
$adapter
->
configureSchema
(
$schema
,
$otherConnection
,
fn
(
)
=> false
)
;
$this
->
assertFalse
(
$schema
->
hasTable
(
'cache_items'
)
)
;
}
public
function
testConfigureSchemaTableExists
(
)
{
$connection
= DriverManager::
getConnection
(
[
'driver' => 'pdo_sqlite', 'path' => self::
$dbFile
]
,
$this
->
getDbalConfig
(
)
)
;
$schema
=
new
Schema
(
)
;