function FilterFormatRepositoryTest::testGetFormatsForAccount

Same name and namespace in other branches
  1. main core/modules/filter/tests/src/Kernel/FilterFormatRepositoryTest.php \Drupal\Tests\filter\Kernel\FilterFormatRepositoryTest::testGetFormatsForAccount()

@legacy-covers ::getFormatsForAccount

File

core/modules/filter/tests/src/Kernel/FilterFormatRepositoryTest.php, line 67

Class

FilterFormatRepositoryTest
Tests the Drupal\filter\FilterFormatRepositoryInterface service.

Namespace

Drupal\Tests\filter\Kernel

Code

public function testGetFormatsForAccount() : void {
  $account = $this->createUser([
    'use text format foo',
  ]);
  $actual = $this->repository
    ->getFormatsForAccount($account);
  // User has access to 'foo' based on their permissions but 'plain_text',
  // with weight 10, is also available because it's the fallback format.
  $this->assertSame([
    'plain_text',
    'foo',
  ], array_keys($actual));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.