update
This commit is contained in:
@@ -42,7 +42,10 @@ class TrackerNodeAccessTest extends BrowserTestBase {
|
||||
*/
|
||||
public function testTrackerNodeAccess() {
|
||||
// Create user with node test view permission.
|
||||
$access_user = $this->drupalCreateUser(['node test view', 'access user profiles']);
|
||||
$access_user = $this->drupalCreateUser([
|
||||
'node test view',
|
||||
'access user profiles',
|
||||
]);
|
||||
|
||||
// Create user without node test view permission.
|
||||
$no_access_user = $this->drupalCreateUser(['access user profiles']);
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\Tests\tracker\Functional;
|
||||
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
|
||||
/**
|
||||
* Tests recent content link.
|
||||
*
|
||||
* @group tracker
|
||||
*/
|
||||
class TrackerRecentContentLinkTest extends BrowserTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected static $modules = ['block', 'tracker'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $defaultTheme = 'stark';
|
||||
|
||||
/**
|
||||
* Tests the recent content link in menu block.
|
||||
*/
|
||||
public function testRecentContentLink() {
|
||||
$this->drupalGet('<front>');
|
||||
$this->assertSession()->linkNotExists('Recent content');
|
||||
$this->drupalPlaceBlock('system_menu_block:tools');
|
||||
|
||||
// Create a regular user.
|
||||
$user = $this->drupalCreateUser();
|
||||
|
||||
// Log in and get the homepage.
|
||||
$this->drupalLogin($user);
|
||||
$this->drupalGet('<front>');
|
||||
|
||||
$link = $this->xpath('//ul/li/a[contains(@href, :href) and text()=:text]', [
|
||||
':menu_class' => 'menu-item',
|
||||
':href' => '/activity',
|
||||
':text' => 'Recent content',
|
||||
]);
|
||||
$this->assertCount(1, $link);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -215,7 +215,11 @@ class TrackerTest extends BrowserTestBase {
|
||||
$this->assertTitle($this->user->getAccountName() . ' | Drupal');
|
||||
|
||||
// Verify that unpublished comments are removed from the tracker.
|
||||
$admin_user = $this->drupalCreateUser(['post comments', 'administer comments', 'access user profiles']);
|
||||
$admin_user = $this->drupalCreateUser([
|
||||
'post comments',
|
||||
'administer comments',
|
||||
'access user profiles',
|
||||
]);
|
||||
$this->drupalLogin($admin_user);
|
||||
$this->drupalPostForm('comment/1/edit', ['status' => CommentInterface::NOT_PUBLISHED], t('Save'));
|
||||
$this->drupalGet('user/' . $this->user->id() . '/activity');
|
||||
@@ -418,7 +422,11 @@ class TrackerTest extends BrowserTestBase {
|
||||
public function testTrackerAdminUnpublish() {
|
||||
\Drupal::service('module_installer')->install(['views']);
|
||||
\Drupal::service('router.builder')->rebuild();
|
||||
$admin_user = $this->drupalCreateUser(['access content overview', 'administer nodes', 'bypass node access']);
|
||||
$admin_user = $this->drupalCreateUser([
|
||||
'access content overview',
|
||||
'administer nodes',
|
||||
'bypass node access',
|
||||
]);
|
||||
$this->drupalLogin($admin_user);
|
||||
|
||||
$node = $this->drupalCreateNode([
|
||||
|
||||
Reference in New Issue
Block a user