diff --git a/migrations/.gitkeep b/migrations/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/migrations/poll_field_instance.yml b/migrations/poll_field_instance.yml index 6a0f25719..e1b284026 100644 --- a/migrations/poll_field_instance.yml +++ b/migrations/poll_field_instance.yml @@ -27,4 +27,4 @@ destination: plugin: entity:field_config migration_dependencies: required: - - poll_field_storage_config \ No newline at end of file + - poll_field_storage_config diff --git a/migrations/state/.gitkeep b/migrations/state/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/Plugin/migrate/destination/PollVote.php b/src/Plugin/migrate/destination/PollVote.php index 9c7d1bd43..2a8d4f605 100644 --- a/src/Plugin/migrate/destination/PollVote.php +++ b/src/Plugin/migrate/destination/PollVote.php @@ -97,4 +97,3 @@ class PollVote extends DestinationBase implements ContainerFactoryPluginInterfac } } - diff --git a/src/Plugin/migrate/source/Poll.php b/src/Plugin/migrate/source/Poll.php index 982d0ddff..1baa0ab69 100644 --- a/src/Plugin/migrate/source/Poll.php +++ b/src/Plugin/migrate/source/Poll.php @@ -2,8 +2,8 @@ namespace Drupal\poll\Plugin\migrate\source; -use Drupal\migrate\Plugin\migrate\source\SqlBase; use Drupal\migrate\Row; +use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase; /** * Gets the poll data from the source database. @@ -13,7 +13,7 @@ use Drupal\migrate\Row; * source_module = "poll" * ) */ -class Poll extends SqlBase { +class Poll extends DrupalSqlBase { /** * {@inheritdoc} diff --git a/tests/src/Kernel/Plugin/migrate/source/PollTest.php b/tests/src/Kernel/Plugin/migrate/source/PollTest.php new file mode 100644 index 000000000..7944707bf --- /dev/null +++ b/tests/src/Kernel/Plugin/migrate/source/PollTest.php @@ -0,0 +1,115 @@ + [ + [ + 'nid' => 1, + 'vid' => 1, + 'type' => 'poll', + 'language' => 'en', + 'title' => 'node title 1', + 'uid' => 1, + 'status' => 1, + 'created' => 1279051598, + 'changed' => 1279051598, + 'comment' => 2, + 'promote' => 1, + 'sticky' => 0, + 'tnid' => 0, + 'translate' => 0, + ], + [ + 'nid' => 2, + 'vid' => 2, + 'type' => 'poll', + 'language' => 'en', + 'title' => 'node title 2', + 'uid' => 1, + 'status' => 1, + 'created' => 1279290908, + 'changed' => 1279308993, + 'comment' => 0, + 'promote' => 1, + 'sticky' => 0, + 'tnid' => 0, + 'translate' => 0, + ], + [ + 'nid' => 4, + 'vid' => 2, + 'type' => 'page', + 'language' => 'en', + 'title' => 'node title 2', + 'uid' => 1, + 'status' => 1, + 'created' => 1279290908, + 'changed' => 1279308993, + 'comment' => 0, + 'promote' => 1, + 'sticky' => 0, + 'tnid' => 0, + 'translate' => 0, + ], + ], + 'poll' => [ + [ + 'nid' => '1', + 'runtime' => '0', + 'active' => '1', + ], + [ + 'nid' => '2', + 'runtime' => '31536000', + 'active' => '1', + ], + [ + 'nid' => '3', + 'runtime' => '0', + 'active' => '1', + ], + ], + 'poll_choice' => [ + [ + 'chid' => 'foo', + 'nid' => '`', + 'chtext' => 'barr', + 'weight' => '9', + ], + ], + ]; + // The expected results are identical to the source data. + $tests[0]['expected_results'] = $tests[0]['database']['node']; + $tests[0]['expected_results'][0]['runtime'] = '0'; + $tests[0]['expected_results'][0]['active'] = '1'; + $tests[0]['expected_results'][1]['runtime'] = '31536000'; + $tests[0]['expected_results'][1]['active'] = '1'; + + return $tests; + } + +}