From a53da806b4bd67e911f73b91324c4fb547816f39 Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Sat, 15 Oct 2016 06:35:25 +0100 Subject: [PATCH] Issue #2807943 by phenaproxima, erozqba: Convert Tracker's Migrate source tests to new base class --- .../migrate/source/d7/TrackerNodeTest.php | 42 ++++++++++++++++++ .../migrate/source/d7/TrackerUserTest.php | 43 +++++++++++++++++++ .../migrate/source/d7/TrackerNodeTest.php | 39 ----------------- .../migrate/source/d7/TrackerUserTest.php | 40 ----------------- 4 files changed, 85 insertions(+), 79 deletions(-) create mode 100644 core/modules/tracker/tests/src/Kernel/Plugin/migrate/source/d7/TrackerNodeTest.php create mode 100644 core/modules/tracker/tests/src/Kernel/Plugin/migrate/source/d7/TrackerUserTest.php delete mode 100644 core/modules/tracker/tests/src/Unit/Plugin/migrate/source/d7/TrackerNodeTest.php delete mode 100644 core/modules/tracker/tests/src/Unit/Plugin/migrate/source/d7/TrackerUserTest.php diff --git a/core/modules/tracker/tests/src/Kernel/Plugin/migrate/source/d7/TrackerNodeTest.php b/core/modules/tracker/tests/src/Kernel/Plugin/migrate/source/d7/TrackerNodeTest.php new file mode 100644 index 000000000000..0318b8e7bd7a --- /dev/null +++ b/core/modules/tracker/tests/src/Kernel/Plugin/migrate/source/d7/TrackerNodeTest.php @@ -0,0 +1,42 @@ +<?php + +namespace Drupal\Tests\tracker\Kernel\Plugin\migrate\source\d7; + +use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase; + +/** + * Tests D7 tracker node source plugin. + * + * @covers Drupal\tracker\Plugin\migrate\source\d7\TrackerNode + * + * @group tracker + */ +class TrackerNodeTest extends MigrateSqlSourceTestBase { + + /** + * {@inheritdoc} + */ + public static $modules = ['tracker', 'migrate_drupal']; + + /** + * {@inheritdoc} + */ + public function providerSource() { + $tests = []; + + // The source data. + $tests[0]['database']['tracker_node'] = [ + [ + 'nid' => '2', + 'published' => '1', + 'changed' => '1421727536', + ] + ]; + + // The expected results are identical to the source data. + $tests[0]['expected_results'] = $tests[0]['database']['tracker_node']; + + return $tests; + } + +} diff --git a/core/modules/tracker/tests/src/Kernel/Plugin/migrate/source/d7/TrackerUserTest.php b/core/modules/tracker/tests/src/Kernel/Plugin/migrate/source/d7/TrackerUserTest.php new file mode 100644 index 000000000000..ffcee93b56cb --- /dev/null +++ b/core/modules/tracker/tests/src/Kernel/Plugin/migrate/source/d7/TrackerUserTest.php @@ -0,0 +1,43 @@ +<?php + +namespace Drupal\Tests\tracker\Kernel\Plugin\migrate\source\d7; + +use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase; + +/** + * Tests D7 tracker user source plugin. + * + * @covers Drupal\tracker\Plugin\migrate\source\d7\TrackerUser + * + * @group tracker + */ +class TrackerUserTest extends MigrateSqlSourceTestBase { + + /** + * {@inheritdoc} + */ + public static $modules = ['tracker', 'migrate_drupal']; + + /** + * {@inheritdoc} + */ + public function providerSource() { + $tests = []; + + // The source data. + $tests[0]['database']['tracker_user'] = [ + [ + 'nid' => '1', + 'uid' => '2', + 'published' => '1', + 'changed' => '1421727536', + ] + ]; + + // The expected results are identical to the source data. + $tests[0]['expected_results'] = $tests[0]['database']['tracker_user']; + + return $tests; + } + +} diff --git a/core/modules/tracker/tests/src/Unit/Plugin/migrate/source/d7/TrackerNodeTest.php b/core/modules/tracker/tests/src/Unit/Plugin/migrate/source/d7/TrackerNodeTest.php deleted file mode 100644 index 49f42400a9a7..000000000000 --- a/core/modules/tracker/tests/src/Unit/Plugin/migrate/source/d7/TrackerNodeTest.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -namespace Drupal\Tests\tracker\Unit\Plugin\migrate\source\d7; - -use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase; - -/** - * Tests D7 tracker node source plugin. - * - * @group tracker - */ -class TrackerNodeTest extends MigrateSqlSourceTestCase { - - const PLUGIN_CLASS = 'Drupal\tracker\Plugin\migrate\source\d7\TrackerNode'; - - protected $migrationConfiguration = [ - 'id' => 'test', - 'source' => [ - 'plugin' => 'd7_tracker_node', - ], - ]; - - protected $expectedResults = [ - [ - 'nid' => '2', - 'published' => '1', - 'changed' => '1421727536', - ] - ]; - - /** - * {@inheritdoc} - */ - protected function setUp() { - $this->databaseContents['tracker_node'] = $this->expectedResults; - parent::setUp(); - } - -} diff --git a/core/modules/tracker/tests/src/Unit/Plugin/migrate/source/d7/TrackerUserTest.php b/core/modules/tracker/tests/src/Unit/Plugin/migrate/source/d7/TrackerUserTest.php deleted file mode 100644 index 847869e2f672..000000000000 --- a/core/modules/tracker/tests/src/Unit/Plugin/migrate/source/d7/TrackerUserTest.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -namespace Drupal\Tests\tracker\Unit\Plugin\migrate\source\d7; - -use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase; - -/** - * Tests D7 tracker user source plugin. - * - * @group tracker - */ -class TrackerUserTest extends MigrateSqlSourceTestCase { - - const PLUGIN_CLASS = 'Drupal\tracker\Plugin\migrate\source\d7\TrackerUser'; - - protected $migrationConfiguration = [ - 'id' => 'test', - 'source' => [ - 'plugin' => 'd7_tracker_user', - ], - ]; - - protected $expectedResults = [ - [ - 'nid' => '1', - 'uid' => '2', - 'published' => '1', - 'changed' => '1421727536', - ] - ]; - - /** - * {@inheritdoc} - */ - protected function setUp() { - $this->databaseContents['tracker_user'] = $this->expectedResults; - parent::setUp(); - } - -} -- GitLab