Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
revertMigration example
->
get
(
SalesChannelContextFactory::
class
)
->
create
(
'test', TestDefaults::SALES_CHANNEL
)
;
$this
->loader =
$this
->
getContainer
(
)
->
get
(
ProductConfiguratorLoader::
class
)
;
$this
->connection =
$this
->
getContainer
(
)
->
get
(
Connection::
class
)
;
}
public
function
testMigration
(
)
: void
{
$this
->connection->
rollBack
(
)
;
$this
->
revertMigration
(
)
;
$hasIndex
=
$this
->
hasIndex
(
)
;
static
::
assertFalse
(
$hasIndex
)
;
$this
->
executeMigration
(
)
;
$hasIndex
=
$this
->
hasIndex
(
)
;
static
::
assertTrue
(
$hasIndex
)
;
class
Migration1687462843ProductManufacturerMediaThumbnailsTest
extends
TestCase
{
use
KernelTestBehaviour;
public
function
testUpdate
(
)
: void
{
/** @var Connection $con */
$con
=
$this
->
getContainer
(
)
->
get
(
Connection::
class
)
;
if
(
\
count
(
$this
->
thumbnailSizesIds
(
$con
)
)
> 1
)
{
$this
->
revertMigration
(
$con
)
;
}
// 1920px is already registered
static
::
assertCount
(
1,
$this
->
thumbnailSizesIds
(
$con
)
)
;
$productManufacturerFolderConfigurationId
=
$this
->
getProductManufacturerFolderConfigurationId
(
$con
)
;
static
::
assertNotNull
(
$productManufacturerFolderConfigurationId
)
;
static
::
assertCount
(
0,
$this
->
getConfiguredThumbnailSizeIds
(
$con
,
$productManufacturerFolderConfigurationId
)
)
;
class
Migration1687463180ProductMediaThumbnailsTest
extends
TestCase
{
use
KernelTestBehaviour;
public
function
testUpdate
(
)
: void
{
/** @var Connection $con */
$con
=
$this
->
getContainer
(
)
->
get
(
Connection::
class
)
;
if
(
$this
->
thumbnailSizesIds
(
$con
)
!==
[
]
)
{
$this
->
revertMigration
(
$con
)
;
}
static
::
assertCount
(
0,
$this
->
thumbnailSizesIds
(
$con
)
)
;
$productManufacturerFolderConfigurationId
=
$this
->
getProductFolderConfigurationId
(
$con
)
;
static
::
assertNotNull
(
$productManufacturerFolderConfigurationId
)
;
$beforeConfiguredThumbnailSizeIds
=
$this
->
getConfiguredThumbnailSizeIds
(
$con
,
$productManufacturerFolderConfigurationId
)
;
$m
=
new
Migration1687463180ProductMediaThumbnails
(
)
;