Verified Commit 90e026fc authored by Alex Pott's avatar Alex Pott
Browse files

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

Issue #3260391 by huzooka, arunkumark, Spokje, quietone: BlockedIp::import violates MigrateDestinationInterface::import
parent e25c11d1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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')];
  }

}
+3 −1
Original line number Diff line number Diff line
@@ -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'));
  }