Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
MigrationState example
$url
= vfsStream::
url
(
'modules'
)
;
foreach
(
$files
as
$module
=>
$contents
)
{
$path
=
$url
. '/' .
$module
. '/migrations/state';
mkdir
(
$path
, '0755', TRUE
)
;
file_put_contents
(
$path
. '/' .
$module
. '.migrate_drupal.yml',
$contents
)
;
}
$moduleHandler
->
getModuleDirectories
(
)
->
willReturn
(
array_combine
(
array_keys
(
$files
)
,
array_map
(
function
D
$module
)
use
(
$url
)
{
return
$url
. '/' .
$module
;
}
,
array_keys
(
$files
)
)
)
)
;
$migrationState
=
new
MigrationState
(
$fieldPluginManager
->
reveal
(
)
,
$moduleHandler
->
reveal
(
)
,
$this
->
createMock
(
MessengerInterface::
class
)
,
$this
->
getStringTranslationStub
(
)
)
;
$all_migrations
=
[
]
;
foreach
(
$migrations
as
$name
=>
$values
)
{
$migration
=
$this
->
prophesize
(
MigrationInterface::
class
)
;
$source
=
$this
->
prophesize
(
MigrateSourceInterface::
class
)
;
$destination
=
$this
->
prophesize
(
MigrateDestinationInterface::
class
)
;
$source
->
getSourceModule
(
)
->
willReturn
(
$values
[
'source_module'
]
)
;
$destination
->
getDestinationModule
(
)
->
willReturn
(
$values
[
'destination_module'
]
)
;
$migration
->
getSourcePlugin
(
)
->
willReturn
(
$source
->
reveal
(
)
)
;
$migration
->
getDestinationPlugin
(
)
->
willReturn
(
$destination
->
reveal
(
)
)
;