/**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();

    $this->installSchema('user', 'users_data');

    $this->flagCountService = \Drupal::service('flag.count');
    $this->flaggingDelete = \Drupal::service('flagging');

    // Create a flag.
    $this->flag = Flag::create([
      'id' => strtolower($this->randomMachineName()),
      'label' => $this->randomString(),
      'entity_type' => 'node',
      'bundles' => ['article'],
      'flag_type' => 'entity:node',
      'link_type' => 'reload',
      'flagTypeConfig' => [],
      'linkTypeConfig' => [],
    ]);
    $this->flag->save();

    // Create a user who may flag.
    $this->adminUser = $this->createUser([
      'administer flags',
    ]);

    $article = NodeType::create(['type' => 'article']);
    $article->save();

    // Create a node to flag.
    $this->node = Node::create([
      'type' => 'article',
      'title' => $this->randomMachineName(8),
    ]);
    $this->node->save();
  }