Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
isDefaultPrevented example
->
willReturn
(
[
'ALTER TABLE pizza ADD COLUMN extra_cheese boolean'
]
)
;
// we use the platform to generate the full create table sql
$platform
->
expects
(
$this
->
once
(
)
)
->
method
(
'getCreateTableSQL'
)
->
with
(
$table
)
->
willReturn
(
'CREATE TABLE pizza (id integer NOT NULL)'
)
;
$subscriber
=
new
MessengerTransportDoctrineSchemaListener
(
[
$otherTransport
,
$doctrineTransport
]
)
;
$subscriber
->
onSchemaCreateTable
(
$event
)
;
$this
->
assertTrue
(
$event
->
isDefaultPrevented
(
)
)
;
$this
->
assertSame
(
[
'CREATE TABLE pizza (id integer NOT NULL)',
'ALTER TABLE pizza ADD COLUMN extra_cheese boolean',
]
,
$event
->
getSql
(
)
)
;
}
public
function
testOnSchemaCreateTableNoExtraSql
(
)
{
$platform
=
$this
->
createMock
(
AbstractPlatform::
class
)
;
$table
=
new
Table
(
'queue_table'
)
;
$event
=
new
SchemaCreateTableEventArgs
(
$table
,
[
]
,
[
]
,
$platform
)
;