Commit 2f7b4e3e authored by alexpott's avatar alexpott

Issue #2807845 by quietone: Convert Ban's Migrate source tests to new base class

(cherry picked from commit 9baedb6e)
parent 6418429c
<?php
namespace Drupal\Tests\ban\Kernel\Plugin\migrate\source\d7;
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
/**
* Tests D7 blocked_ip source plugin.
*
* @covers \Drupal\ban\Plugin\migrate\source\d7\BlockedIps
* @group ban
*/
class BlockedIpsTest extends MigrateSqlSourceTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['ban', 'migrate_drupal'];
/**
* {@inheritdoc}
*/
public function providerSource() {
$tests = [];
$tests[0]['source_data']['blocked_ips'] = [
[
'iid' => 1,
'ip' => '127.0.0.1',
]
];
$tests[0]['expected_data'] = [
[
'ip' => '127.0.0.1',
],
];
return $tests;
}
}
<?php
namespace Drupal\Tests\ban\Unit\Plugin\migrate\source\d7;
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
/**
* Tests D7 blocked_ip source plugin.
*
* @coversDefaultClass \Drupal\ban\Plugin\migrate\source\d7\BlockedIps
* @group ban
*/
class BlockedIpsTest extends MigrateSqlSourceTestCase {
const PLUGIN_CLASS = 'Drupal\ban\Plugin\migrate\source\d7\BlockedIps';
protected $migrationConfiguration = [
'id' => 'test',
'source' => [
'plugin' => 'd7_blocked_ips',
],
];
protected $expectedResults = [
[
'ip' => '127.0.0.1',
],
];
/**
* {@inheritdoc}
*/
protected function setUp() {
$this->databaseContents['blocked_ips'] = [
[
'iid' => 1,
'ip' => '127.0.0.1',
]
];
parent::setUp();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment