diff --git a/.cspell-project-words.txt b/.cspell-project-words.txt
index 527197286a80d1ab406dadf7c8ae15a29cc4491a..c8170349df0a914ea20a11ec3882e3613c6a2de3 100644
--- a/.cspell-project-words.txt
+++ b/.cspell-project-words.txt
@@ -3,6 +3,7 @@ behaviour
 Berdir
 disp
 fago
+fcid
 flagcount
 Flaggable
 flaggable
diff --git a/migrations/d6_flag.yml b/migrations/d6_flag.yml
new file mode 100644
index 0000000000000000000000000000000000000000..806bc350f1e30bc17b5a78c61d72f7a4433a7bae
--- /dev/null
+++ b/migrations/d6_flag.yml
@@ -0,0 +1,29 @@
+id: d6_flag
+label: Flag configuration
+migration_group: flag
+dependencies:
+  enforced:
+    module:
+      - flag
+source:
+  plugin: d6_flag_source
+  source_module: flag
+process:
+  id: name
+  label: title
+  bundles: bundles
+  entity_type: content_type
+  global: global
+  weight: '0'
+  flag_short: 'options/flag_short'
+  flag_long: 'options/flag_long'
+  flag_message: 'options/flag_message'
+  unflag_short: 'options/unflag_short'
+  unflag_long: 'options/unflag_long'
+  unflag_message: 'options/unflag_message'
+  flag_type: flag_type
+  link_type: ajax_link
+  flagTypeConfig: flagTypeConfig
+  linkTypeConfig: linkTypeConfig
+destination:
+  plugin: entity:flag
diff --git a/migrations/d6_flagging.yml b/migrations/d6_flagging.yml
new file mode 100644
index 0000000000000000000000000000000000000000..472ff13dc887cba90c9d7e856129a42794aa7ac6
--- /dev/null
+++ b/migrations/d6_flagging.yml
@@ -0,0 +1,32 @@
+id: d6_flagging
+label: Flagging
+migration_group: flag
+migration_tags:
+  - Drupal 6
+dependencies:
+  enforced:
+    module:
+      - flag
+migration_dependencies:
+  required:
+    - d6_flag
+    - d6_user
+source:
+  plugin: d6_flagging_source
+process:
+  id: fcid
+  flag_id: name
+  entity_type: content_type
+  entity_id: content_id
+  global: global
+  uid:
+    -
+      plugin: migration_lookup
+      migration: d6_user
+      source: uid
+    -
+      plugin: skip_on_empty
+      method: row
+  created: timestamp
+destination:
+  plugin: entity:flagging
diff --git a/src/FlagCountManager.php b/src/FlagCountManager.php
index ff67133b1fa027e08f4f802cd6926a8e9e3bfb82..00c4f8c6f7175b5d610a46cda6628a8e99853bf8 100644
--- a/src/FlagCountManager.php
+++ b/src/FlagCountManager.php
@@ -197,20 +197,22 @@ class FlagCountManager implements FlagCountManagerInterface, EventSubscriberInte
     $flag = $flagging->getFlag();
     $entity = $flagging->getFlaggable();
 
-    $this->connection->merge('flag_counts')
-      ->keys([
-        'flag_id' => $flag->id(),
-        'entity_id' => $entity->id(),
-        'entity_type' => $entity->getEntityTypeId(),
-      ])
-      ->fields([
-        'last_updated' => $this->dateTime->getRequestTime(),
-        'count' => 1,
-      ])
-      ->expression('count', 'count + :inc', [':inc' => 1])
-      ->execute();
+    if ($entity) {
+      $this->connection->merge('flag_counts')
+        ->keys([
+          'flag_id' => $flag->id(),
+          'entity_id' => $entity->id(),
+          'entity_type' => $entity->getEntityTypeId(),
+        ])
+        ->fields([
+          'last_updated' => $this->dateTime->getRequestTime(),
+          'count' => 1,
+        ])
+        ->expression('count', 'count + :inc', [':inc' => 1])
+        ->execute();
 
-    $this->resetLoadedCounts($entity, $flag);
+      $this->resetLoadedCounts($entity, $flag);
+    }
   }
 
   /**
diff --git a/src/Plugin/migrate/source/d6/Flag.php b/src/Plugin/migrate/source/d6/Flag.php
new file mode 100644
index 0000000000000000000000000000000000000000..7d5a8425f97d6d470bca1198e06a8dd208d6ebe9
--- /dev/null
+++ b/src/Plugin/migrate/source/d6/Flag.php
@@ -0,0 +1,76 @@
+<?php
+
+namespace Drupal\flag\Plugin\migrate\source\d6;
+
+use Drupal\migrate\Row;
+use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
+
+/**
+ * Drupal 6 Flag source from database.
+ *
+ * @MigrateSource(
+ *   id = "d6_flag_source",
+ *   source_module = "flag"
+ * )
+ */
+class Flag extends DrupalSqlBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function query() {
+    return $this->select('flags', 'f')->fields('f');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function fields() {
+    return [
+      'fid' => $this->t('The unique ID for this particular flag.'),
+      'entity_type' => $this->t('The entity type of the flagged entity.'),
+      'name' => $this->t('The machine name of the flag.'),
+      'title' => $this->t('The human readable title of the flag.'),
+      'global' => $this->t('Whether this flag state should act as a single toggle to all users across the site.'),
+      'options' => $this->t('Flag options.'),
+      'default_weight' => $this->t('Default weight applied to new items.'),
+    ];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function prepareRow(Row $row) {
+    $source_options = unserialize($row->getSourceProperty('options'));
+    $row->setSourceProperty('options', $source_options);
+
+    $flag_entity_type = $row->getSourceProperty('content_type');
+    $row->setSourceProperty('flag_type', 'entity:' . $flag_entity_type);
+
+    $bundles = [];
+    $d6_bundles = $this->select('flag_types', 'ft')
+      ->fields('ft', ['type'])
+      ->condition('fid', $row->getSourceProperty('fid'))
+      ->execute();
+
+    while ($bundle = $d6_bundles->fetchAssoc()) {
+      $bundles[] = $bundle['type'];
+    }
+    $row->setSourceProperty('bundles', $bundles);
+
+    $row->setSourceProperty('flagTypeConfig', []);
+    $row->setSourceProperty('linkTypeConfig', []);
+
+    return parent::prepareRow($row);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getIds() {
+    $ids['fid']['type'] = 'integer';
+
+    return $ids;
+  }
+
+}
diff --git a/src/Plugin/migrate/source/d6/Flagging.php b/src/Plugin/migrate/source/d6/Flagging.php
new file mode 100644
index 0000000000000000000000000000000000000000..deeadabd28b97f9e0c0dff6aa647f6478cfab1c0
--- /dev/null
+++ b/src/Plugin/migrate/source/d6/Flagging.php
@@ -0,0 +1,69 @@
+<?php
+
+namespace Drupal\flag\Plugin\migrate\source\d6;
+
+use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
+
+/**
+ * Drupal 6 Flag source from database.
+ *
+ * @MigrateSource(
+ *   id = "d6_flagging_source",
+ *   source_module = "flag"
+ * )
+ */
+class Flagging extends FieldableEntity {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function query() {
+    $query = $this->select('flag_content', 'fi');
+
+    $query->join('flags', 'f', 'f.fid = fi.fid');
+
+    $query->fields('fi', [
+      'fid',
+      'uid',
+      'content_type',
+      'content_id',
+      'timestamp',
+      'fcid',
+    ]);
+
+    $query->fields('f', [
+      'name',
+      'global',
+    ]);
+
+    $query->orderBy('fi.timestamp');
+
+    return $query;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function fields() {
+    return [
+      'fcid' => $this->t('The unique ID for this particular tag.'),
+      'fid' => $this->t('The unique flag ID this object has been flagged with, from flag.'),
+      'content_type' => $this->t('The entity type of the flagged entity.'),
+      'content_id' => $this->t('The unique ID of the flagged entity, for example the uid, cid, or nid.'),
+      'uid' => $this->t('The user ID by whom this object was flagged.'),
+      'timestamp' => $this->t('The UNIX time stamp representing when the flag was set.'),
+      'name' => $this->t('The machine name of the flag.'),
+      'global' => $this->t('If the flag is global.'),
+    ];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getIds() {
+    $ids['fcid']['type'] = 'integer';
+    $ids['fcid']['alias'] = 'fi';
+    return $ids;
+  }
+
+}
diff --git a/tests/fixtures/drupal6.php b/tests/fixtures/drupal6.php
new file mode 100644
index 0000000000000000000000000000000000000000..8d2c77890162b3090070bca445067924ef2bccf8
--- /dev/null
+++ b/tests/fixtures/drupal6.php
@@ -0,0 +1,502 @@
+<?php
+// @codingStandardsIgnoreFile
+/**
+ * @file
+ * A database agnostic dump for testing purposes.
+ */
+
+use Drupal\Core\Database\Database;
+
+$connection = Database::getConnection();
+
+$connection->insert('system')
+  ->fields([
+    'filename',
+    'name',
+    'type',
+    'owner',
+    'status',
+    'bootstrap',
+    'schema_version',
+    'weight',
+    'info',
+  ])
+  ->values([
+    'filename' => 'sites/all/modules/contrib/flag/flag.module',
+    'name' => 'flag',
+    'type' => 'module',
+    'owner' => '',
+    'status' => '1',
+    'bootstrap' => '0',
+    'schema_version' => '7306',
+    'weight' => '0',
+    'info' => 'a:5:{s:4:"name";s:4:"Flag";s:11:"description";s:55:"Create customized flags that users can set on entities.";s:4:"core";s:3:"7.x";s:7:"package";s:4:"Flag";s:9:"configure";s:21:"admin/structure/flags";}',
+  ])
+  ->execute();
+
+$connection->schema()->createTable('flags', [
+  'fields' => [
+    'fid' => [
+      'type' => 'serial',
+      'size' => 'small',
+      'unsigned' => TRUE,
+      'not null' => TRUE,
+    ],
+    'content_type' => [
+      'type' => 'varchar',
+      'length' => '128',
+      'not null' => TRUE,
+      'default' => '',
+    ],
+    'name' => [
+      'type' => 'varchar',
+      'length' => '32',
+      'not null' => FALSE,
+      'default' => '',
+    ],
+    'title' => [
+      'type' => 'varchar',
+      'length' => '255',
+      'not null' => FALSE,
+      'default' => '',
+    ],
+    'global' => [
+      'type' => 'int',
+      'size' => 'tiny',
+      'not null' => FALSE,
+      'default' => 0,
+    ],
+    'options' => [
+      'type' => 'text',
+      'not null' => FALSE,
+    ],
+  ],
+  'primary key' => ['fid'],
+  'unique keys' => [
+    'name' => ['name'],
+  ],
+]);
+
+$connection->schema()->createTable('flag_content', [
+  'fields' => [
+    'fcid' => [
+      'type' => 'serial',
+      'unsigned' => TRUE,
+      'not null' => TRUE,
+    ],
+    'fid' => [
+      'type' => 'int',
+      'size' => 'small',
+      'unsigned' => TRUE,
+      'not null' => TRUE,
+      'default' => 0,
+    ],
+    'content_type' => [
+      'type' => 'varchar',
+      'length' => '128',
+      'not null' => TRUE,
+      'default' => '',
+    ],
+    'content_id' => [
+      'type' => 'int',
+      'unsigned' => TRUE,
+      'not null' => TRUE,
+      'default' => 0,
+    ],
+    'uid' => [
+      'type' => 'int',
+      'unsigned' => TRUE,
+      'not null' => TRUE,
+      'default' => 0,
+    ],
+    'sid' => [
+      'type' => 'int',
+      'unsigned' => TRUE,
+      'not null' => TRUE,
+      'default' => 0,
+    ],
+    'timestamp' => [
+      'type' => 'int',
+      'unsigned' => TRUE,
+      'not null' => TRUE,
+      'default' => 0,
+      'disp-size' => 11,
+    ],
+  ],
+  'primary key' => ['fcid'],
+  'unique keys' => [
+    'fid_content_id_uid_sid' => ['fid', 'content_id', 'uid', 'sid'],
+  ],
+  'indexes' => [
+    'content_type_uid_sid' => ['content_type', 'uid', 'sid'],
+    'content_type_content_id_uid_sid' => [
+      'content_type',
+      'content_id',
+      'uid',
+      'sid',
+    ],
+    'content_id_fid' => ['content_id', 'fid'],
+  ],
+]);
+
+$connection->schema()->createTable('flag_types', [
+  'fields' => [
+    'fid' => [
+      'type' => 'int',
+      'size' => 'small',
+      'unsigned' => TRUE,
+      'not null' => TRUE,
+      'default' => 0,
+    ],
+    'type' => [
+      'description' => 'The entity bundles that can be flagged by this fid.',
+      'type' => 'varchar',
+      'length' => '128',
+      'not null' => TRUE,
+      'default' => '',
+    ],
+  ],
+  'indexes' => ['fid' => ['fid']],
+]);
+
+$connection->schema()->createTable('flag_counts', [
+  'fields' => [
+    'fid' => [
+      'type' => 'int',
+      'size' => 'small',
+      'unsigned' => TRUE,
+      'not null' => TRUE,
+      'default' => 0,
+    ],
+    'content_type' => [
+      'type' => 'varchar',
+      'length' => '128',
+      'not null' => TRUE,
+      'default' => '',
+    ],
+    'content_id' => [
+      'type' => 'int',
+      'unsigned' => TRUE,
+      'not null' => TRUE,
+      'default' => 0,
+      'disp-width' => '10',
+    ],
+    'count' => [
+      'type' => 'int',
+      'unsigned' => TRUE,
+      'not null' => TRUE,
+      'default' => 0,
+      'disp-width' => '10',
+    ],
+  ],
+  'primary key' => ['fid', 'content_id'],
+  'indexes' => [
+    'fid_content_type' => ['fid', 'content_type'],
+    'content_type_content_id' => ['content_type', 'content_id'],
+    'fid_count' => ['fid', 'count'],
+  ],
+]);
+
+$connection->schema()->createTable('flag_actions', [
+  'fields' => [
+    'aid' => [
+      'type' => 'serial',
+      'not null' => TRUE,
+      'disp-width' => '5',
+    ],
+    'fid' => [
+      'type' => 'int',
+      'size' => 'small',
+      'not null' => FALSE,
+      'disp-width' => '5',
+    ],
+    'event' => [
+      'type' => 'varchar',
+      'length' => '255',
+      'not null' => FALSE,
+    ],
+    'threshold' => [
+      'type' => 'int',
+      'size' => 'small',
+      'not null' => TRUE,
+      'default' => 0,
+      'disp-width' => '5',
+    ],
+    'repeat_threshold' => [
+      'type' => 'int',
+      'size' => 'small',
+      'not null' => TRUE,
+      'default' => 0,
+      'disp-width' => '5',
+    ],
+    'callback' => [
+      'type' => 'varchar',
+      'length' => '255',
+      'not null' => TRUE,
+      'default' => '',
+    ],
+    'parameters' => [
+      'type' => 'text',
+      'size' => 'big',
+      'not null' => TRUE,
+    ],
+  ],
+  'primary key' => ['aid'],
+]);
+
+$connection->insert('flags')
+  ->fields([
+    'fid',
+    'content_type',
+    'name',
+    'title',
+    'global',
+    'options',
+  ])
+  ->values([
+    '1',
+    'node',
+    'node_flag',
+    'Node Flag',
+    '0',
+    'a:15:{s:4:"il8n";i:0;s:13:"show_in_links";a:1:{s:7:"default";s:7:"default";}s:13:"access_author";s:6:"others";s:13:"show_as_field";b:0;s:12:"show_on_form";b:0;s:20:"show_contextual_link";b:0;s:6:"weight";i:0;s:10:"flag_short";s:4:"Flag";s:9:"flag_long";s:23:"Add a flag to this item";s:12:"flag_message";s:22:"Item has been flagged.";s:12:"unflag_short";s:6:"Unflag";s:11:"unflag_long";s:27:"Remove flag from this item.";s:14:"unflag_message";s:22:"Flag has been removed.";s:18:"unflag_denied_text";s:47:"You do not have permission to remove this flag.";s:9:"link_type";s:6:"toggle";}',
+  ])
+  ->values([
+    '2',
+    'user',
+    'user_flag',
+    'User flag',
+    '0',
+    'a:16:{s:10:"access_uid";b:0;s:13:"access_author";s:0:"";s:13:"show_in_links";a:0:{}s:13:"show_as_field";b:0;s:12:"show_on_form";b:0;s:20:"show_contextual_link";b:0;s:15:"show_on_profile";b:1;s:6:"weight";i:0;s:10:"flag_short";s:4:"Flag";s:9:"flag_long";s:23:"Add a flag to this item";s:12:"flag_message";s:22:"Item has been flagged.";s:12:"unflag_short";s:6:"Unflag";s:11:"unflag_long";s:27:"Remove flag from this item.";s:14:"unflag_message";s:22:"Flag has been removed.";s:18:"unflag_denied_text";s:47:"You do not have permission to remove this flag.";s:9:"link_type";s:6:"toggle";}',
+  ])
+  ->values([
+    '3',
+    'node',
+    'node_global_flag',
+    'Node global flag',
+    '1',
+    'a:17:{s:4:"il8n";i:0;s:13:"show_in_links";a:1:{s:7:"default";s:7:"default";}s:13:"access_author";s:0:"";s:13:"show_as_field";b:0;s:12:"show_on_form";b:0;s:20:"show_contextual_link";b:0;s:17:"flag_confirmation";s:40:"Are you sure you want to flag this item?";s:19:"unflag_confirmation";s:42:"Are you sure you want to remove this flag?";s:6:"weight";i:0;s:10:"flag_short";s:0:"";s:9:"flag_long";s:0:"";s:12:"flag_message";s:0:"";s:12:"unflag_short";s:0:"";s:11:"unflag_long";s:0:"";s:14:"unflag_message";s:0:"";s:18:"unflag_denied_text";s:0:"";s:9:"link_type";s:7:"confirm";}',
+  ])
+  ->values([
+    '4',
+    'comment',
+    'comment_flag',
+    'Comment flag',
+    '0',
+    'a:14:{s:13:"access_author";s:6:"others";s:13:"show_in_links";a:1:{s:7:"default";s:7:"default";}s:13:"show_as_field";b:0;s:12:"show_on_form";b:0;s:20:"show_contextual_link";b:0;s:6:"weight";i:0;s:10:"flag_short";s:4:"Flag";s:9:"flag_long";s:23:"Add a flag to this item";s:12:"flag_message";s:22:"Item has been flagged.";s:12:"unflag_short";s:6:"Unflag";s:11:"unflag_long";s:27:"Remove flag from this item.";s:14:"unflag_message";s:22:"Flag has been removed.";s:18:"unflag_denied_text";s:47:"You do not have permission to remove this flag.";s:9:"link_type";s:6:"toggle";}',
+  ])
+  ->execute();
+
+$connection->insert('flag_content')
+  ->fields([
+    'fcid',
+    'fid',
+    'content_id',
+    'content_type',
+    'uid',
+    'sid',
+    'timestamp',
+  ])
+  ->values([
+    '1',
+    '1',
+    '2',
+    'node',
+    '2',
+    '0',
+    '1564543637',
+  ])
+  ->values([
+    '2',
+    '1',
+    '2',
+    'node',
+    '8',
+    '0',
+    '1564543637',
+  ])
+  ->values([
+    '3',
+    '1',
+    '5',
+    'node',
+    '2',
+    '0',
+    '1564543637',
+  ])
+  ->values([
+    '4',
+    '1',
+    '5',
+    'node',
+    '8',
+    '0',
+    '1564543637',
+  ])
+  ->values([
+    '5',
+    '1',
+    '6',
+    'node',
+    '8',
+    '0',
+    '1564543637',
+  ])
+  ->values([
+    '6',
+    '2',
+    '2',
+    'user',
+    '8',
+    '0',
+    '1564543637',
+  ])
+  ->values([
+    '7',
+    '3',
+    '5',
+    'node',
+    '8',
+    '0',
+    '1564543637',
+  ])
+  ->values([
+    '8',
+    '1',
+    '8',
+    'node',
+    '8',
+    '0',
+    '1564543637',
+  ])
+  ->values([
+    '9',
+    '1',
+    '11',
+    'node',
+    '8',
+    '0',
+    '1564543637',
+  ])
+  ->values([
+    '10',
+    '4',
+    '1',
+    'comment',
+    '2',
+    '0',
+    '1564543637',
+  ])
+  ->values([
+    '11',
+    '4',
+    '2',
+    'comment',
+    '2',
+    '0',
+    '1564543637',
+  ])
+  ->values([
+    '12',
+    '4',
+    '2',
+    'comment',
+    '8',
+    '0',
+    '1564543637',
+  ])
+  ->execute();
+
+$connection->insert('flag_types')
+  ->fields([
+    'fid',
+    'type',
+  ])
+  ->values([
+    '1',
+    'article',
+  ])
+  ->values([
+    '1',
+    'blog',
+  ])
+  ->values([
+    '2',
+    'user',
+  ])
+  ->values([
+    '3',
+    'article',
+  ])
+  ->values([
+    '4',
+    'comment_test_content_type',
+  ])
+  ->values([
+    '4',
+    'article',
+  ])
+  ->execute();
+
+$connection->insert('flag_counts')
+  ->fields([
+    'fid',
+    'content_type',
+    'content_id',
+    'count',
+  ])
+  ->values([
+    '1',
+    'node',
+    '2',
+    '2',
+  ])
+  ->values([
+    '1',
+    'node',
+    '5',
+    '2',
+  ])
+  ->values([
+    '1',
+    'node',
+    '6',
+    '1',
+  ])
+  ->values([
+    '2',
+    'user',
+    '2',
+    '1',
+  ])
+  ->values([
+    '3',
+    'node',
+    '5',
+    '1',
+  ])
+  ->values([
+    '1',
+    'node',
+    '8',
+    '1',
+  ])
+  ->values([
+    '1',
+    'node',
+    '11',
+    '1',
+  ])
+  ->values([
+    '4',
+    'comment',
+    '1',
+    '1',
+  ])
+  ->values([
+    '4',
+    'comment',
+    '2',
+    '2',
+  ])
+  ->execute();
diff --git a/tests/src/Kernel/MigrateDrupal6FlagTest.php b/tests/src/Kernel/MigrateDrupal6FlagTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..7764b6b9bd67c7b6f25b87a1beff305b3db74142
--- /dev/null
+++ b/tests/src/Kernel/MigrateDrupal6FlagTest.php
@@ -0,0 +1,79 @@
+<?php
+
+namespace Drupal\Tests\flag\Kernel;
+
+use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
+
+/**
+ * Tests migration of flags.
+ *
+ * @group flag
+ */
+class MigrateDrupal6FlagTest extends MigrateDrupal6TestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected static $modules = [
+    'system',
+    'user',
+    'node',
+    'comment',
+    'taxonomy',
+    'text',
+    'menu_ui',
+    'flag',
+  ];
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp(): void {
+    parent::setUp();
+
+    $fixture = __DIR__ . '/../../fixtures/drupal6.php';
+    $this->assertNotFalse(realpath($fixture));
+    $this->loadFixture($fixture);
+
+    $this->installEntitySchema('flag');
+    $this->installEntitySchema('node_type');
+    $this->installEntitySchema('node');
+    $this->installEntitySchema('user');
+    $this->installEntitySchema('comment_type');
+    $this->installEntitySchema('comment');
+    $this->installEntitySchema('taxonomy_term');
+    $this->installEntitySchema('taxonomy_vocabulary');
+    $this->installConfig(static::$modules);
+
+    $this->executeMigration('d6_comment_type');
+    $this->executeMigration('d6_node_type');
+    $this->executeMigration('d6_taxonomy_vocabulary');
+    $this->executeMigration('d6_flag');
+  }
+
+  /**
+   * Asserts that flags have been migrated.
+   */
+  public function testMigrationResults() {
+    /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager */
+    $entityTypeManager = $this->container->get('entity_type.manager');
+    /** @var \Drupal\flag\Entity\Flag[] $flags */
+    $flags = $entityTypeManager
+      ->getStorage('flag')
+      ->loadMultiple();
+
+    $this->assertCount(4, $flags);
+    // Comments.
+    $this->assertEquals([
+      'article',
+      'comment_test_content_type',
+    ], $flags['comment_flag']->getBundles());
+    // Nodes.
+    $this->assertEquals(['article', 'blog'], $flags['node_flag']->getBundles());
+    // User.
+    $this->assertEquals(['user'], $flags['user_flag']->getBundles());
+    // Node global.
+    $this->assertEquals(['article'], $flags['node_global_flag']->getBundles());
+  }
+
+}
diff --git a/tests/src/Kernel/MigrateDrupal6FlaggingTest.php b/tests/src/Kernel/MigrateDrupal6FlaggingTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..cb3017bc8209317bde16941a41a137c4496c5eef
--- /dev/null
+++ b/tests/src/Kernel/MigrateDrupal6FlaggingTest.php
@@ -0,0 +1,109 @@
+<?php
+
+namespace Drupal\Tests\flag\Kernel;
+
+use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
+
+/**
+ * Tests migration of flagging data.
+ *
+ * @group flag
+ */
+class MigrateDrupal6FlaggingTest extends MigrateDrupal6TestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected static $modules = [
+    'system',
+    'user',
+    'node',
+    'comment',
+    'taxonomy',
+    'text',
+    'filter',
+    'menu_ui',
+    'phpass',
+    'flag',
+  ];
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp(): void {
+    parent::setUp();
+
+    $fixture = __DIR__ . '/../../fixtures/drupal6.php';
+    $this->assertNotFalse(realpath($fixture));
+    $this->loadFixture($fixture);
+
+    $this->installSchema('comment', ['comment_entity_statistics']);
+    $this->installSchema('flag', ['flag_counts']);
+    $this->installEntitySchema('flag');
+    $this->installEntitySchema('flagging');
+    $this->installEntitySchema('node_type');
+    $this->installEntitySchema('node');
+    $this->installEntitySchema('user');
+    $this->installEntitySchema('comment_type');
+    $this->installEntitySchema('comment');
+    $this->installEntitySchema('taxonomy_term');
+    $this->installEntitySchema('taxonomy_vocabulary');
+    $this->installConfig(static::$modules);
+
+    $this->executeMigration('d6_filter_format');
+    $this->executeMigration('d6_user_role');
+    $this->executeMigration('d6_node_settings');
+    $this->executeMigration('d6_node_type');
+    $this->executeMigration('d6_field');
+    $this->executeMigration('d6_field_instance');
+    $this->executeMigration('d6_user');
+    $this->executeMigration('d6_comment_type');
+    $this->executeMigration('d6_comment_field');
+    $this->executeMigration('d6_comment_field_instance');
+    $this->executeMigration('d6_comment_entity_display');
+    $this->executeMigration('d6_comment_entity_form_display');
+    $this->executeMigration('d6_taxonomy_vocabulary');
+    $this->executeMigration('d6_node');
+    $this->executeMigration('d6_node:page');
+    $this->executeMigration('d6_node:company');
+    $this->executeMigration('d6_node:employee');
+    $this->executeMigration('d6_node:story');
+    $this->executeMigration('d6_node:test_planet');
+    $this->executeMigration('d6_node:forum');
+    $this->executeMigration('d6_comment');
+    $this->executeMigration('d6_taxonomy_term');
+    $this->executeMigration('d6_flag');
+    $this->executeMigration('d6_flagging');
+  }
+
+  /**
+   * Asserts that flagging entities have been migrated.
+   */
+  public function testMigrationResults() {
+    /** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager */
+    $entityTypeManager = $this->container->get('entity_type.manager');
+    /** @var \Drupal\flag\Entity\Flagging[] $flaggings */
+    $flaggings = $entityTypeManager
+      ->getStorage('flagging')
+      ->loadMultiple();
+
+    $this->assertCount(12, $flaggings);
+
+    // Test flagging.
+    $actual = $flaggings[1]->toArray();
+    unset($actual['uuid']);
+    $expected = [
+      'id' => [0 => ['value' => 1]],
+      'flag_id' => [0 => ['target_id' => 'node_flag']],
+      'entity_type' => [0 => ['value' => 'node']],
+      'entity_id' => [0 => ['value' => 2]],
+      'flagged_entity' => [0 => ['target_id' => 2]],
+      'global' => [0 => ['value' => 0]],
+      'uid' => [0 => ['target_id' => 2]],
+      'session_id' => [],
+      'created' => [0 => ['value' => '1564543637']],
+    ];
+    $this->assertEquals($expected, $actual);
+  }
+
+}