TermHandlerTest.php in Permissions by Term 8.2
File
tests/src/Kernel/TermHandlerTest.php
View source
<?php
namespace Drupal\Tests\permissions_by_term\Kernel;
use Drupal\permissions_by_term\Service\TermHandler;
class TermHandlerTest extends PBTKernelTestBase {
protected function setUp() {
parent::setUp();
}
public function testGetTidsBoundForAllNids() : void {
$this
->createRelationOneGrantedTerm();
$this
->createRelationOneGrantedTerm();
$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);
}
}