You are here

protected function FlagKernelTestBase::getFlagFlaggings in Flag 8.4

Get all flaggings for the given flag.

Parameters

\Drupal\flag\FlagInterface $flag: The flag entity.

Return value

\Drupal\flag\FlaggingInterface[] An array of flaggings.

3 calls to FlagKernelTestBase::getFlagFlaggings()
FlagCountsTest::testEntityDeletion in tests/src/Kernel/FlagCountsTest.php
Tests flaggings and counts are deleted when its entity is deleted.
FlagCountsTest::testFlagDeletion in tests/src/Kernel/FlagCountsTest.php
Tests flaggings are deleted and counts are removed when a flag is deleted.
FlagCountsTest::testUserDeletion in tests/src/Kernel/FlagCountsTest.php
Tests flaggings and counts are deleted when its user is deleted.

File

tests/src/Kernel/FlagKernelTestBase.php, line 66

Class

FlagKernelTestBase
Basic setup for kernel tests based around flaggings articles.

Namespace

Drupal\Tests\flag\Kernel

Code

protected function getFlagFlaggings(FlagInterface $flag) {
  $query = \Drupal::entityQuery('flagging');
  $query
    ->condition('flag_id', $flag
    ->id());
  $ids = $query
    ->execute();
  return \Drupal::entityTypeManager()
    ->getStorage('flagging')
    ->loadMultiple($ids);
}