update
This commit is contained in:
@@ -53,8 +53,24 @@ class BookBreadcrumbTest extends BrowserTestBase {
|
||||
$this->drupalPlaceBlock('page_title_block');
|
||||
|
||||
// Create users.
|
||||
$this->bookAuthor = $this->drupalCreateUser(['create new books', 'create book content', 'edit own book content', 'add content to books']);
|
||||
$this->adminUser = $this->drupalCreateUser(['create new books', 'create book content', 'edit any book content', 'delete any book content', 'add content to books', 'administer blocks', 'administer permissions', 'administer book outlines', 'administer content types', 'administer site configuration']);
|
||||
$this->bookAuthor = $this->drupalCreateUser([
|
||||
'create new books',
|
||||
'create book content',
|
||||
'edit own book content',
|
||||
'add content to books',
|
||||
]);
|
||||
$this->adminUser = $this->drupalCreateUser([
|
||||
'create new books',
|
||||
'create book content',
|
||||
'edit any book content',
|
||||
'delete any book content',
|
||||
'add content to books',
|
||||
'administer blocks',
|
||||
'administer permissions',
|
||||
'administer book outlines',
|
||||
'administer content types',
|
||||
'administer site configuration',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -46,7 +46,16 @@ class BookContentModerationTest extends BrowserTestBase {
|
||||
$workflow->save();
|
||||
|
||||
// We need a user with additional content moderation permissions.
|
||||
$this->bookAuthor = $this->drupalCreateUser(['create new books', 'create book content', 'edit own book content', 'add content to books', 'access printer-friendly version', 'view any unpublished content', 'use editorial transition create_new_draft', 'use editorial transition publish']);
|
||||
$this->bookAuthor = $this->drupalCreateUser([
|
||||
'create new books',
|
||||
'create book content',
|
||||
'edit own book content',
|
||||
'add content to books',
|
||||
'access printer-friendly version',
|
||||
'view any unpublished content',
|
||||
'use editorial transition create_new_draft',
|
||||
'use editorial transition publish',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -61,10 +61,32 @@ class BookTest extends BrowserTestBase {
|
||||
node_access_rebuild();
|
||||
|
||||
// Create users.
|
||||
$this->bookAuthor = $this->drupalCreateUser(['create new books', 'create book content', 'edit own book content', 'add content to books']);
|
||||
$this->webUser = $this->drupalCreateUser(['access printer-friendly version', 'node test view']);
|
||||
$this->webUserWithoutNodeAccess = $this->drupalCreateUser(['access printer-friendly version']);
|
||||
$this->adminUser = $this->drupalCreateUser(['create new books', 'create book content', 'edit any book content', 'delete any book content', 'add content to books', 'administer blocks', 'administer permissions', 'administer book outlines', 'node test view', 'administer content types', 'administer site configuration']);
|
||||
$this->bookAuthor = $this->drupalCreateUser([
|
||||
'create new books',
|
||||
'create book content',
|
||||
'edit own book content',
|
||||
'add content to books',
|
||||
]);
|
||||
$this->webUser = $this->drupalCreateUser([
|
||||
'access printer-friendly version',
|
||||
'node test view',
|
||||
]);
|
||||
$this->webUserWithoutNodeAccess = $this->drupalCreateUser([
|
||||
'access printer-friendly version',
|
||||
]);
|
||||
$this->adminUser = $this->drupalCreateUser([
|
||||
'create new books',
|
||||
'create book content',
|
||||
'edit any book content',
|
||||
'delete any book content',
|
||||
'add content to books',
|
||||
'administer blocks',
|
||||
'administer permissions',
|
||||
'administer book outlines',
|
||||
'node test view',
|
||||
'administer content types',
|
||||
'administer site configuration',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,7 +242,7 @@ class BookTest extends BrowserTestBase {
|
||||
|
||||
// Load the book and verify there is no printer-friendly version link.
|
||||
$this->drupalGet('node/' . $this->book->id());
|
||||
$this->assertNoLink(t('Printer-friendly version'), 'Anonymous user is not shown link to printer-friendly version.');
|
||||
$this->assertSession()->linkNotExists(t('Printer-friendly version'), 'Anonymous user is not shown link to printer-friendly version.');
|
||||
|
||||
// Try getting the URL directly, and verify it fails.
|
||||
$this->drupalGet('book/export/html/' . $this->book->id());
|
||||
@@ -402,13 +424,13 @@ class BookTest extends BrowserTestBase {
|
||||
// Create new node not yet a book.
|
||||
$empty_book = $this->drupalCreateNode(['type' => 'book']);
|
||||
$this->drupalGet('node/' . $empty_book->id() . '/outline');
|
||||
$this->assertNoLink(t('Book outline'), 'Book Author is not allowed to outline');
|
||||
$this->assertSession()->linkNotExists(t('Book outline'), 'Book Author is not allowed to outline');
|
||||
|
||||
$this->drupalLogin($this->adminUser);
|
||||
$this->drupalGet('node/' . $empty_book->id() . '/outline');
|
||||
$this->assertRaw(t('Book outline'));
|
||||
$this->assertOptionSelected('edit-book-bid', 0, 'Node does not belong to a book');
|
||||
$this->assertNoLink(t('Remove from book outline'));
|
||||
$this->assertSession()->linkNotExists(t('Remove from book outline'));
|
||||
|
||||
$edit = [];
|
||||
$edit['book[bid]'] = '1';
|
||||
@@ -557,7 +579,11 @@ class BookTest extends BrowserTestBase {
|
||||
$this->createBook();
|
||||
|
||||
// Create administrator user.
|
||||
$administratorUser = $this->drupalCreateUser(['administer blocks', 'administer nodes', 'bypass node access']);
|
||||
$administratorUser = $this->drupalCreateUser([
|
||||
'administer blocks',
|
||||
'administer nodes',
|
||||
'bypass node access',
|
||||
]);
|
||||
$this->drupalLogin($administratorUser);
|
||||
|
||||
// Enable the block with "Show block only on book pages" mode.
|
||||
|
||||
@@ -153,7 +153,7 @@ class BookRelationshipTest extends ViewTestBase {
|
||||
$this->drupalGet('test-book/' . $nodes[$i]->id());
|
||||
|
||||
for ($j = 0; $j < $i; $j++) {
|
||||
$this->assertLink($nodes[$j]->label());
|
||||
$this->assertSession()->linkExists($nodes[$j]->label());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user