MigrateBlockedIpsTest.php

Same filename and directory in other branches
  1. 9 core/modules/ban/tests/src/Kernel/Migrate/d7/MigrateBlockedIpsTest.php
  2. 8.9.x core/modules/ban/tests/src/Kernel/Migrate/d7/MigrateBlockedIpsTest.php
  3. 10 core/modules/ban/tests/src/Kernel/Migrate/d7/MigrateBlockedIpsTest.php

Namespace

Drupal\Tests\ban\Kernel\Migrate\d7

File

core/modules/ban/tests/src/Kernel/Migrate/d7/MigrateBlockedIpsTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\ban\Kernel\Migrate\d7;

use Drupal\Tests\SchemaCheckTestTrait;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;

/**
 * Migrate blocked IPs.
 *
 * @group ban
 */
class MigrateBlockedIpsTest extends MigrateDrupal7TestBase {
    use SchemaCheckTestTrait;
    
    /**
     * Modules to enable.
     *
     * @var array
     */
    protected static $modules = [
        'ban',
    ];
    
    /**
     * {@inheritdoc}
     */
    protected function setUp() : void {
        parent::setUp();
        $this->installSchema('ban', [
            'ban_ip',
        ]);
    }
    
    /**
     * Tests migration of blocked IPs.
     */
    public function testBlockedIps() : void {
        $this->startCollectingMessages();
        $this->executeMigration('d7_blocked_ips');
        $this->assertEmpty($this->migrateMessages);
        $this->assertTrue(\Drupal::service('ban.ip_manager')->isBanned('111.111.111.111'));
    }

}

Classes

Title Deprecated Summary
MigrateBlockedIpsTest Migrate blocked IPs.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.