Same filename in this branch
- 10 core/modules/node/tests/src/Functional/NodeAccessPagerTest.php
- 10 core/modules/forum/tests/src/Functional/NodeAccessPagerTest.php
Namespace
Drupal\Tests\forum\Functional
File
core/modules/forum/tests/src/Functional/NodeAccessPagerTest.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\forum\Functional;
use Drupal\Tests\BrowserTestBase;
class NodeAccessPagerTest extends BrowserTestBase {
protected static $modules = [
'node_access_test',
'forum',
];
protected $webUser;
protected $defaultTheme = 'stark';
protected function setUp() : void {
parent::setUp();
node_access_rebuild();
$this
->drupalCreateContentType([
'type' => 'page',
'name' => 'Basic page',
]);
$this->webUser = $this
->drupalCreateUser([
'access content',
'node test view',
]);
}
public function testForumPager() {
$vid = $this
->config('forum.settings')
->get('vocabulary');
$this
->assertNotEmpty($vid, 'Forum navigation vocabulary ID is set.');
$tree = \Drupal::entityTypeManager()
->getStorage('taxonomy_term')
->loadTree($vid, 0, 1);
$tid = reset($tree)->tid;
$this
->assertNotEmpty($tid, 'General discussion term is found in the forum vocabulary.');
for ($i = 0; $i < 30; $i++) {
$this
->drupalCreateNode([
'nid' => NULL,
'type' => 'forum',
'taxonomy_forums' => [
[
'target_id' => $tid,
],
],
]);
}
$this
->drupalLogin($this->webUser);
$this
->drupalGet('forum/' . $tid);
$this
->assertSession()
->responseContains('page=1');
$this
->assertSession()
->responseNotContains('page=2');
}
}
Classes