Issue #3260391 by huzooka, arunkumark, Spokje, quietone: BlockedIp::import violates MigrateDestinationInterface::import

merge-requests/3252/head
Alex Pott 2023-01-13 15:39:46 +00:00
parent 2316fd5b29
commit 4936c9bd07
No known key found for this signature in database
GPG Key ID: BDA67E7EE836E5CE
3 changed files with 5 additions and 6 deletions

View File

@ -78,6 +78,8 @@ class BlockedIp extends DestinationBase implements ContainerFactoryPluginInterfa
*/
public function import(Row $row, array $old_destination_id_values = []) {
$this->banManager->banIp($row->getDestinationProperty('ip'));
return ['ip' => $row->getDestinationProperty('ip')];
}
}

View File

@ -27,13 +27,15 @@ class MigrateBlockedIpsTest extends MigrateDrupal7TestBase {
protected function setUp(): void {
parent::setUp();
$this->installSchema('ban', ['ban_ip']);
$this->executeMigration('d7_blocked_ips');
}
/**
* Tests migration of blocked IPs.
*/
public function testBlockedIps() {
$this->startCollectingMessages();
$this->executeMigration('d7_blocked_ips');
$this->assertEmpty($this->migrateMessages);
$this->assertTrue(\Drupal::service('ban.ip_manager')->isBanned('111.111.111.111'));
}

View File

@ -800,11 +800,6 @@ parameters:
count: 1
path: modules/action/src/Form/ActionFormBase.php
-
message: "#^Method Drupal\\\\ban\\\\Plugin\\\\migrate\\\\destination\\\\BlockedIp\\:\\:import\\(\\) should return array\\|bool but return statement is missing\\.$#"
count: 1
path: modules/ban/src/Plugin/migrate/destination/BlockedIp.php
-
message: "#^\\#lazy_builder callback 'hello_or_yarhar' at key '0' is not callable\\.$#"
count: 1