From a94bff87d542370a5bd34ec27f31ed79a22bb308 Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Sat, 15 Oct 2016 06:40:03 +0100 Subject: [PATCH] Issue #2807871 by phenaproxima, svendecabooter: Convert Book's Migrate source tests to new base class --- .../Plugin/migrate/source/d6/BookTest.php | 84 ++++++++++++++++++ .../Plugin/migrate/source/d6/BookTest.php | 85 ------------------- 2 files changed, 84 insertions(+), 85 deletions(-) create mode 100644 core/modules/book/tests/src/Kernel/Plugin/migrate/source/d6/BookTest.php delete mode 100644 core/modules/book/tests/src/Unit/Plugin/migrate/source/d6/BookTest.php diff --git a/core/modules/book/tests/src/Kernel/Plugin/migrate/source/d6/BookTest.php b/core/modules/book/tests/src/Kernel/Plugin/migrate/source/d6/BookTest.php new file mode 100644 index 000000000000..feece1f7bcf0 --- /dev/null +++ b/core/modules/book/tests/src/Kernel/Plugin/migrate/source/d6/BookTest.php @@ -0,0 +1,84 @@ +<?php + +namespace Drupal\Tests\book\Kernel\Plugin\migrate\source\d6; + +use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase; + +/** + * @covers \Drupal\book\Plugin\migrate\source\d6\Book + * @group book + */ +class BookTest extends MigrateSqlSourceTestBase { + + /** + * {@inheritdoc} + */ + public static $modules = ['book', 'migrate_drupal']; + + /** + * {@inheritdoc} + */ + public function providerSource() { + $tests = []; + + // The source data. + $tests[0]['source_data']['book'] = [ + [ + 'mlid' => '1', + 'nid' => '4', + 'bid' => '4', + ], + ]; + $tests[0]['source_data']['menu_links'] = [ + [ + 'menu_name' => 'book-toc-1', + 'mlid' => '1', + 'plid' => '0', + 'link_path' => 'node/4', + 'router_path' => 'node/%', + 'link_title' => 'Test top book title', + 'options' => 'a:0:{}', + 'module' => 'book', + 'hidden' => '0', + 'external' => '0', + 'has_children' => '1', + 'expanded' => '0', + 'weight' => '-10', + 'depth' => '1', + 'customized' => '0', + 'p1' => '1', + 'p2' => '0', + 'p3' => '0', + 'p4' => '0', + 'p5' => '0', + 'p6' => '0', + 'p7' => '0', + 'p8' => '0', + 'p9' => '0', + 'updated' => '0', + ], + ]; + + // 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; + } + +} diff --git a/core/modules/book/tests/src/Unit/Plugin/migrate/source/d6/BookTest.php b/core/modules/book/tests/src/Unit/Plugin/migrate/source/d6/BookTest.php deleted file mode 100644 index 6433cadcd451..000000000000 --- a/core/modules/book/tests/src/Unit/Plugin/migrate/source/d6/BookTest.php +++ /dev/null @@ -1,85 +0,0 @@ -<?php - -namespace Drupal\Tests\book\Unit\Plugin\migrate\source\d6; - -use Drupal\book\Plugin\migrate\source\d6\Book; -use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase; - -/** - * @coversDefaultClass \Drupal\book\Plugin\migrate\source\d6\Book - * @group book - */ -class BookTest extends MigrateSqlSourceTestCase { - - 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} - */ - protected function setUp() { - $this->databaseContents['book'] = array( - array( - 'mlid' => '1', - 'nid' => '4', - 'bid' => '4', - ), - ); - $this->databaseContents['menu_links'] = array( - array( - 'menu_name' => 'book-toc-1', - 'mlid' => '1', - 'plid' => '0', - 'link_path' => 'node/4', - 'router_path' => 'node/%', - 'link_title' => 'Test top book title', - 'options' => 'a:0:{}', - 'module' => 'book', - 'hidden' => '0', - 'external' => '0', - 'has_children' => '1', - 'expanded' => '0', - 'weight' => '-10', - 'depth' => '1', - 'customized' => '0', - 'p1' => '1', - 'p2' => '0', - 'p3' => '0', - 'p4' => '0', - 'p5' => '0', - 'p6' => '0', - 'p7' => '0', - 'p8' => '0', - 'p9' => '0', - 'updated' => '0', - ), - ); - parent::setUp(); - } - -} -- GitLab