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
c3ec3aca
Commit
c3ec3aca
authored
3 years ago
by
Ivan Doroshenko
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/8.x-5.x' into 3015199-allow-skiponvalue-to
parents
e612db7c
ef77138d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!33
Issue #3015199: Allow SkipOnValue to include a message in the MigrateSkipRowException.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Plugin/migrate/process/Gate.php
+16
-9
16 additions, 9 deletions
src/Plugin/migrate/process/Gate.php
tests/src/Unit/process/GateTest.php
+2
-3
2 additions, 3 deletions
tests/src/Unit/process/GateTest.php
with
18 additions
and
12 deletions
src/Plugin/migrate/process/Gate.php
+
16
−
9
View file @
c3ec3aca
...
@@ -84,20 +84,27 @@ class Gate extends ProcessPluginBase {
...
@@ -84,20 +84,27 @@ class Gate extends ProcessPluginBase {
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public
function
transform
(
$value
,
MigrateExecutableInterface
$m
igrat
e_executable
,
Row
$row
,
$dest
in
a
tion
_property
)
{
public
function
__construct
(
array
$conf
ig
u
rat
ion
,
$plugin_id
,
$plugin_def
in
i
tion
)
{
if
(
!
array_key_exists
(
'valid_keys'
,
$
this
->
configuration
))
{
if
(
!
array_key_exists
(
'valid_keys'
,
$configuration
))
{
throw
new
Migrate
Exception
(
'Gate plugin is missing valid_keys configuration.'
);
throw
new
\InvalidArgument
Exception
(
'Gate plugin is missing valid_keys configuration.'
);
}
}
if
(
!
array_key_exists
(
'use_as_key'
,
$
this
->
configuration
))
{
if
(
!
array_key_exists
(
'use_as_key'
,
$configuration
))
{
throw
new
Migrate
Exception
(
'Gate plugin is missing use_as_key configuration.'
);
throw
new
\InvalidArgument
Exception
(
'Gate plugin is missing use_as_key configuration.'
);
}
}
if
(
!
array_key_exists
(
'key_direction'
,
$
this
->
configuration
))
{
if
(
!
array_key_exists
(
'key_direction'
,
$configuration
))
{
throw
new
Migrate
Exception
(
'Gate plugin is missing key_direction configuration.'
);
throw
new
\InvalidArgument
Exception
(
'Gate plugin is missing key_direction configuration.'
);
}
}
if
(
!
in_array
(
$
this
->
configuration
[
'key_direction'
],
[
'lock'
,
'unlock'
],
TRUE
))
{
if
(
!
in_array
(
$configuration
[
'key_direction'
],
[
'lock'
,
'unlock'
],
TRUE
))
{
throw
new
Migrate
Exception
(
'Gate plugin only accepts the following values for key_direction: lock and unlock.'
);
throw
new
\InvalidArgument
Exception
(
'Gate plugin only accepts the following values for key_direction: lock and unlock.'
);
}
}
parent
::
__construct
(
$configuration
,
$plugin_id
,
$plugin_definition
);
}
/**
* {@inheritdoc}
*/
public
function
transform
(
$value
,
MigrateExecutableInterface
$migrate_executable
,
Row
$row
,
$destination_property
)
{
$valid_keys
=
(
array
)
$this
->
configuration
[
'valid_keys'
];
$valid_keys
=
(
array
)
$this
->
configuration
[
'valid_keys'
];
$key
=
$row
->
get
(
$this
->
configuration
[
'use_as_key'
]);
$key
=
$row
->
get
(
$this
->
configuration
[
'use_as_key'
]);
$key_is_valid
=
in_array
(
$key
,
$valid_keys
,
TRUE
);
$key_is_valid
=
in_array
(
$key
,
$valid_keys
,
TRUE
);
...
...
This diff is collapsed.
Click to expand it.
tests/src/Unit/process/GateTest.php
+
2
−
3
View file @
c3ec3aca
...
@@ -156,10 +156,9 @@ class GateTest extends MigrateProcessTestCase {
...
@@ -156,10 +156,9 @@ class GateTest extends MigrateProcessTestCase {
* @dataProvider badConfigurationProvider
* @dataProvider badConfigurationProvider
*/
*/
public
function
testGateBadConfigration
(
$configuration
,
$message
):
void
{
public
function
testGateBadConfigration
(
$configuration
,
$message
):
void
{
$this
->
expectException
(
Migrate
Exception
::
class
);
$this
->
expectException
(
\InvalidArgument
Exception
::
class
);
$this
->
expectExceptionMessage
(
$message
);
$this
->
expectExceptionMessage
(
$message
);
$plugin
=
new
Gate
(
$configuration
,
'gate'
,
[]);
new
Gate
(
$configuration
,
'gate'
,
[]);
$plugin
->
transform
(
NULL
,
$this
->
migrateExecutable
,
$this
->
row
,
'destinationproperty'
);
}
}
/**
/**
...
...
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