From 4936c9bd0724e08de05ca5d6596e3451564410c7 Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Fri, 13 Jan 2023 15:39:46 +0000 Subject: [PATCH] Issue #3260391 by huzooka, arunkumark, Spokje, quietone: BlockedIp::import violates MigrateDestinationInterface::import --- .../modules/ban/src/Plugin/migrate/destination/BlockedIp.php | 2 ++ .../tests/src/Kernel/Migrate/d7/MigrateBlockedIpsTest.php | 4 +++- core/phpstan-baseline.neon | 5 ----- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/core/modules/ban/src/Plugin/migrate/destination/BlockedIp.php b/core/modules/ban/src/Plugin/migrate/destination/BlockedIp.php index 14cb3cd251a7..b0c0e482daef 100644 --- a/core/modules/ban/src/Plugin/migrate/destination/BlockedIp.php +++ b/core/modules/ban/src/Plugin/migrate/destination/BlockedIp.php @@ -78,6 +78,8 @@ public function fields() { */ public function import(Row $row, array $old_destination_id_values = []) { $this->banManager->banIp($row->getDestinationProperty('ip')); + + return ['ip' => $row->getDestinationProperty('ip')]; } } diff --git a/core/modules/ban/tests/src/Kernel/Migrate/d7/MigrateBlockedIpsTest.php b/core/modules/ban/tests/src/Kernel/Migrate/d7/MigrateBlockedIpsTest.php index f814e1962793..c63b75228084 100644 --- a/core/modules/ban/tests/src/Kernel/Migrate/d7/MigrateBlockedIpsTest.php +++ b/core/modules/ban/tests/src/Kernel/Migrate/d7/MigrateBlockedIpsTest.php @@ -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')); } diff --git a/core/phpstan-baseline.neon b/core/phpstan-baseline.neon index 779ddbc2dd1b..e7c54ba7afda 100644 --- a/core/phpstan-baseline.neon +++ b/core/phpstan-baseline.neon @@ -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 -- GitLab