You are here

public function TermHandlerTest::testGetTidsBoundForAllNids in Permissions by Term 8.2

File

tests/src/Kernel/TermHandlerTest.php, line 20

Class

TermHandlerTest
@group permissions_by_term

Namespace

Drupal\Tests\permissions_by_term\Kernel

Code

public function testGetTidsBoundForAllNids() : void {
  $this
    ->createRelationOneGrantedTerm();
  $this
    ->createRelationOneGrantedTerm();

  /**
   * @var TermHandler $termHandler
   */
  $termHandler = \Drupal::service('permissions_by_term.term_handler');
  $tidsBoundToAllNids = $termHandler
    ->getTidsBoundToAllNidsForPublishedNodes();
  $expectedNidToTidsPairs = array(
    1 => array(
      0 => '1',
      1 => '2',
      2 => '3',
    ),
    2 => array(
      0 => '4',
      1 => '5',
      2 => '6',
    ),
  );
  self::assertArraySubset($expectedNidToTidsPairs, $tidsBoundToAllNids);
}