Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
postGenerateSchema example
$event
=
new
GenerateSchemaEventArgs
(
$entityManager
,
$schema
)
;
$doctrineTransport
=
$this
->
createMock
(
DoctrineTransport::
class
)
;
$doctrineTransport
->
expects
(
$this
->
once
(
)
)
->
method
(
'configureSchema'
)
->
with
(
$schema
,
$dbalConnection
,
fn
(
)
=> true
)
;
$otherTransport
=
$this
->
createMock
(
TransportInterface::
class
)
;
$otherTransport
->
expects
(
$this
->
never
(
)
)
->
method
(
$this
->
anything
(
)
)
;
$subscriber
=
new
MessengerTransportDoctrineSchemaListener
(
[
$doctrineTransport
,
$otherTransport
]
)
;
$subscriber
->
postGenerateSchema
(
$event
)
;
}
public
function
testOnSchemaCreateTable
(
)
{
$platform
=
$this
->
createMock
(
AbstractPlatform::
class
)
;
$table
=
new
Table
(
'queue_table'
)
;
$event
=
new
SchemaCreateTableEventArgs
(
$table
,
[
]
,
[
]
,
$platform
)
;
$otherTransport
=
$this
->
createMock
(
TransportInterface::
class
)
;
$otherTransport
->
expects
(
$this
->
never
(
)
)
->
method
(
$this
->
anything
(
)
)
;
$entityManager
->
expects
(
$this
->
once
(
)
)
->
method
(
'getConnection'
)
->
willReturn
(
$dbalConnection
)
;
$event
=
new
GenerateSchemaEventArgs
(
$entityManager
,
$schema
)
;
$lockStore
=
$this
->
createMock
(
DoctrineDbalStore::
class
)
;
$lockStore
->
expects
(
$this
->
once
(
)
)
->
method
(
'configureSchema'
)
->
with
(
$schema
,
fn
(
)
=> true
)
;
$subscriber
=
new
LockStoreSchemaListener
(
[
$lockStore
]
)
;
$subscriber
->
postGenerateSchema
(
$event
)
;
}
}
$entityManager
->
expects
(
$this
->
once
(
)
)
->
method
(
'getConnection'
)
->
willReturn
(
$dbalConnection
)
;
$event
=
new
GenerateSchemaEventArgs
(
$entityManager
,
$schema
)
;
$pdoSessionHandler
=
$this
->
createMock
(
PdoSessionHandler::
class
)
;
$pdoSessionHandler
->
expects
(
$this
->
once
(
)
)
->
method
(
'configureSchema'
)
->
with
(
$schema
,
fn
(
)
=> true
)
;
$subscriber
=
new
PdoSessionHandlerSchemaListener
(
$pdoSessionHandler
)
;
$subscriber
->
postGenerateSchema
(
$event
)
;
}
}
->
method
(
'getConnection'
)
->
willReturn
(
$dbalConnection
)
;
$event
=
new
GenerateSchemaEventArgs
(
$entityManager
,
$schema
)
;
$dbalAdapter
=
$this
->
createMock
(
DoctrineDbalAdapter::
class
)
;
$dbalAdapter
->
expects
(
$this
->
once
(
)
)
->
method
(
'configureSchema'
)
->
with
(
$schema
,
$dbalConnection
,
fn
(
)
=> true
)
;
$subscriber
=
new
DoctrineDbalCacheAdapterSchemaListener
(
[
$dbalAdapter
]
)
;
$subscriber
->
postGenerateSchema
(
$event
)
;
}
}