Commit a94bff87 authored by alexpott's avatar alexpott

Issue #2807871 by phenaproxima, svendecabooter: Convert Book's Migrate source...

Issue #2807871 by phenaproxima, svendecabooter: Convert Book's Migrate source tests to new base class
parent 62c94225
<?php
namespace Drupal\Tests\book\Unit\Plugin\migrate\source\d6;
namespace Drupal\Tests\book\Kernel\Plugin\migrate\source\d6;
use Drupal\book\Plugin\migrate\source\d6\Book;
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
/**
* @coversDefaultClass \Drupal\book\Plugin\migrate\source\d6\Book
* @covers \Drupal\book\Plugin\migrate\source\d6\Book
* @group book
*/
class BookTest extends MigrateSqlSourceTestCase {
class BookTest extends MigrateSqlSourceTestBase {
const PLUGIN_CLASS = Book::class;
protected $migrationConfiguration = array(
'id' => 'test',
'source' => array(
'plugin' => 'd6_book',
),
);
protected $expectedResults = array(
array(
'nid' => '4',
'bid' => '4',
'mlid' => '1',
'plid' => '0',
'weight' => '-10',
'p1' => '1',
'p2' => '0',
'p3' => '0',
'p4' => '0',
'p5' => '0',
'p6' => '0',
'p7' => '0',
'p8' => '0',
'p9' => '0',
),
);
/**
* {@inheritdoc}
*/
public static $modules = ['book', 'migrate_drupal'];
/**
* {@inheritdoc}
*/
protected function setUp() {
$this->databaseContents['book'] = array(
array(
public function providerSource() {
$tests = [];
// The source data.
$tests[0]['source_data']['book'] = [
[
'mlid' => '1',
'nid' => '4',
'bid' => '4',
),
);
$this->databaseContents['menu_links'] = array(
array(
],
];
$tests[0]['source_data']['menu_links'] = [
[
'menu_name' => 'book-toc-1',
'mlid' => '1',
'plid' => '0',
......@@ -77,9 +56,29 @@ protected function setUp() {
'p8' => '0',
'p9' => '0',
'updated' => '0',
),
);
parent::setUp();
],
];
// The expected results.
$tests[0]['expected_data'] = [
[
'nid' => '4',
'bid' => '4',
'mlid' => '1',
'plid' => '0',
'weight' => '-10',
'p1' => '1',
'p2' => '0',
'p3' => '0',
'p4' => '0',
'p5' => '0',
'p6' => '0',
'p7' => '0',
'p8' => '0',
'p9' => '0',
],
];
return $tests;
}
}
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