Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
Migration1681382023AddCustomFieldAllowCartExpose example
public
function
testColumnGetsCreatedAndExposeSetting
(
)
: void
{
/** @var Connection $con */
$con
=
$this
->
getContainer
(
)
->
get
(
Connection::
class
)
;
if
(
$this
->
columnExists
(
$con
)
)
{
$con
->
executeStatement
(
'ALTER TABLE `custom_field` DROP `allow_cart_expose`;'
)
;
}
static
::
assertFalse
(
$this
->
columnExists
(
$con
)
)
;
$m
=
new
Migration1681382023AddCustomFieldAllowCartExpose
(
)
;
$m
->
update
(
$con
)
;
static
::
assertTrue
(
$this
->
columnExists
(
$con
)
)
;
$con
->
setNestTransactionsWithSavepoints
(
true
)
;
$con
->
beginTransaction
(
)
;
$this
->
createCustomFields
(
)
;
$this
->
createRule
(
)
;
static
::
assertEquals
(
[
'0', '0', '0'
]
,
$this
->
getExposeSettings
(
$con
)
)
;