Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
migrate_plus
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
migrate_plus
Commits
6cfbb3e9
Commit
6cfbb3e9
authored
6 years ago
by
Lucas Hedding
Committed by
Lucas Hedding
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2987787
by SylvainM, heddn: Status of migration config file is not respected
parent
cbb509db
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Entity/Migration.php
+2
-1
2 additions, 1 deletion
src/Entity/Migration.php
src/Plugin/MigrationConfigDeriver.php
+4
-0
4 additions, 0 deletions
src/Plugin/MigrationConfigDeriver.php
tests/src/Kernel/MigrationConfigEntityTest.php
+39
-0
39 additions, 0 deletions
tests/src/Kernel/MigrationConfigEntityTest.php
with
45 additions
and
1 deletion
src/Entity/Migration.php
+
2
−
1
View file @
6cfbb3e9
...
@@ -18,7 +18,8 @@ use Drupal\Core\Entity\EntityTypeInterface;
...
@@ -18,7 +18,8 @@ use Drupal\Core\Entity\EntityTypeInterface;
* entity_keys = {
* entity_keys = {
* "id" = "id",
* "id" = "id",
* "label" = "label",
* "label" = "label",
* "weight" = "weight"
* "weight" = "weight",
* "status" = "status"
* }
* }
* )
* )
*/
*/
...
...
This diff is collapsed.
Click to expand it.
src/Plugin/MigrationConfigDeriver.php
+
4
−
0
View file @
6cfbb3e9
...
@@ -20,6 +20,10 @@ class MigrationConfigDeriver extends DeriverBase {
...
@@ -20,6 +20,10 @@ class MigrationConfigDeriver extends DeriverBase {
$migrations
=
Migration
::
loadMultiple
();
$migrations
=
Migration
::
loadMultiple
();
/** @var \Drupal\migrate_plus\Entity\MigrationInterface $migration */
/** @var \Drupal\migrate_plus\Entity\MigrationInterface $migration */
foreach
(
$migrations
as
$id
=>
$migration
)
{
foreach
(
$migrations
as
$id
=>
$migration
)
{
if
(
!
$migration
->
status
())
{
continue
;
}
$this
->
derivatives
[
$id
]
=
$migration
->
toArray
();
$this
->
derivatives
[
$id
]
=
$migration
->
toArray
();
}
}
return
$this
->
derivatives
;
return
$this
->
derivatives
;
...
...
This diff is collapsed.
Click to expand it.
tests/src/Kernel/MigrationConfigEntityTest.php
+
39
−
0
View file @
6cfbb3e9
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
Drupal\Tests\migrate_plus\Kernel
;
namespace
Drupal\Tests\migrate_plus\Kernel
;
use
Drupal\Component\Plugin\Exception\PluginNotFoundException
;
use
Drupal\KernelTests\KernelTestBase
;
use
Drupal\KernelTests\KernelTestBase
;
use
Drupal\migrate_plus
\Entity\Migration
;
use
Drupal\migrate_plus
\Entity\Migration
;
...
@@ -35,6 +36,7 @@ class MigrationConfigEntityTest extends KernelTestBase {
...
@@ -35,6 +36,7 @@ class MigrationConfigEntityTest extends KernelTestBase {
public
function
testCacheInvalidation
()
{
public
function
testCacheInvalidation
()
{
$config
=
Migration
::
create
([
$config
=
Migration
::
create
([
'id'
=>
'test'
,
'id'
=>
'test'
,
'status'
=>
TRUE
,
'label'
=>
'Label A'
,
'label'
=>
'Label A'
,
'migration_tags'
=>
[],
'migration_tags'
=>
[],
'source'
=>
[],
'source'
=>
[],
...
@@ -57,4 +59,41 @@ class MigrationConfigEntityTest extends KernelTestBase {
...
@@ -57,4 +59,41 @@ class MigrationConfigEntityTest extends KernelTestBase {
$this
->
assertSame
(
'Label B'
,
$this
->
pluginManager
->
getDefinition
(
'test'
)[
'label'
]);
$this
->
assertSame
(
'Label B'
,
$this
->
pluginManager
->
getDefinition
(
'test'
)[
'label'
]);
}
}
/**
* Tests migration status.
*/
public
function
testMigrationStatus
()
{
$configs
=
[
[
'id'
=>
'test_active'
,
'status'
=>
TRUE
,
'label'
=>
'Label Active'
,
'migration_tags'
=>
[],
'source'
=>
[],
'destination'
=>
[],
'migration_dependencies'
=>
[],
],
[
'id'
=>
'test_inactive'
,
'status'
=>
FALSE
,
'label'
=>
'Label Inactive'
,
'migration_tags'
=>
[],
'source'
=>
[],
'destination'
=>
[],
'migration_dependencies'
=>
[],
],
];
foreach
(
$configs
as
$config
)
{
Migration
::
create
(
$config
)
->
save
();
}
$definitions
=
$this
->
pluginManager
->
getDefinitions
();
$this
->
assertCount
(
1
,
$definitions
);
$this
->
assertArrayHasKey
(
'test_active'
,
$definitions
);
$this
->
setExpectedException
(
PluginNotFoundException
::
class
,
'The "test_inactive" plugin does not exist.'
);
$this
->
pluginManager
->
getDefinition
(
'test_inactive'
);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment