update
This commit is contained in:
@@ -58,12 +58,12 @@ class ForumBlockTest extends BrowserTestBase {
|
||||
// Create 5 forum topics.
|
||||
$topics = $this->createForumTopics();
|
||||
|
||||
$this->assertLink(t('More'), 0, 'New forum topics block has a "more"-link.');
|
||||
$this->assertSession()->linkExists(t('More'), 0, 'New forum topics block has a "more"-link.');
|
||||
$this->assertLinkByHref('forum', 0, 'New forum topics block has a "more"-link.');
|
||||
|
||||
// We expect all 5 forum topics to appear in the "New forum topics" block.
|
||||
foreach ($topics as $topic) {
|
||||
$this->assertLink($topic, 0, new FormattableMarkup('Forum topic @topic found in the "New forum topics" block.', ['@topic' => $topic]));
|
||||
$this->assertSession()->linkExists($topic, 0, new FormattableMarkup('Forum topic @topic found in the "New forum topics" block.', ['@topic' => $topic]));
|
||||
}
|
||||
|
||||
// Configure the new forum topics block to only show 2 topics.
|
||||
@@ -75,7 +75,7 @@ class ForumBlockTest extends BrowserTestBase {
|
||||
// topics" block.
|
||||
for ($index = 0; $index < 5; $index++) {
|
||||
if (in_array($index, [3, 4])) {
|
||||
$this->assertLink($topics[$index], 0, new FormattableMarkup('Forum topic @topic found in the "New forum topics" block.', ['@topic' => $topics[$index]]));
|
||||
$this->assertSession()->linkExists($topics[$index], 0, new FormattableMarkup('Forum topic @topic found in the "New forum topics" block.', ['@topic' => $topics[$index]]));
|
||||
}
|
||||
else {
|
||||
$this->assertNoText($topics[$index], new FormattableMarkup('Forum topic @topic not found in the "New forum topics" block.', ['@topic' => $topics[$index]]));
|
||||
@@ -113,7 +113,7 @@ class ForumBlockTest extends BrowserTestBase {
|
||||
// Enable the block.
|
||||
$block = $this->drupalPlaceBlock('forum_active_block');
|
||||
$this->drupalGet('');
|
||||
$this->assertLink(t('More'), 0, 'Active forum topics block has a "more"-link.');
|
||||
$this->assertSession()->linkExists(t('More'), 0, 'Active forum topics block has a "more"-link.');
|
||||
$this->assertLinkByHref('forum', 0, 'Active forum topics block has a "more"-link.');
|
||||
|
||||
// We expect the first 5 forum topics to appear in the "Active forum topics"
|
||||
@@ -121,7 +121,7 @@ class ForumBlockTest extends BrowserTestBase {
|
||||
$this->drupalGet('<front>');
|
||||
for ($index = 0; $index < 10; $index++) {
|
||||
if ($index < 5) {
|
||||
$this->assertLink($topics[$index], 0, new FormattableMarkup('Forum topic @topic found in the "Active forum topics" block.', ['@topic' => $topics[$index]]));
|
||||
$this->assertSession()->linkExists($topics[$index], 0, new FormattableMarkup('Forum topic @topic found in the "Active forum topics" block.', ['@topic' => $topics[$index]]));
|
||||
}
|
||||
else {
|
||||
$this->assertNoText($topics[$index], new FormattableMarkup('Forum topic @topic not found in the "Active forum topics" block.', ['@topic' => $topics[$index]]));
|
||||
@@ -138,7 +138,7 @@ class ForumBlockTest extends BrowserTestBase {
|
||||
// the "Active forum topics" block.
|
||||
for ($index = 0; $index < 10; $index++) {
|
||||
if (in_array($index, [3, 4])) {
|
||||
$this->assertLink($topics[$index], 0, 'Forum topic found in the "Active forum topics" block.');
|
||||
$this->assertSession()->linkExists($topics[$index], 0, 'Forum topic found in the "Active forum topics" block.');
|
||||
}
|
||||
else {
|
||||
$this->assertNoText($topics[$index], 'Forum topic not found in the "Active forum topics" block.');
|
||||
|
||||
@@ -27,7 +27,13 @@ class ForumIndexTest extends BrowserTestBase {
|
||||
parent::setUp();
|
||||
|
||||
// Create a test user.
|
||||
$web_user = $this->drupalCreateUser(['create forum content', 'edit own forum content', 'edit any forum content', 'administer nodes', 'administer forums']);
|
||||
$web_user = $this->drupalCreateUser([
|
||||
'create forum content',
|
||||
'edit own forum content',
|
||||
'edit any forum content',
|
||||
'administer nodes',
|
||||
'administer forums',
|
||||
]);
|
||||
$this->drupalLogin($web_user);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,12 @@ class ForumNodeAccessTest extends BrowserTestBase {
|
||||
// Create some users.
|
||||
$access_user = $this->drupalCreateUser(['node test view']);
|
||||
$no_access_user = $this->drupalCreateUser();
|
||||
$admin_user = $this->drupalCreateUser(['access administration pages', 'administer modules', 'administer blocks', 'create forum content']);
|
||||
$admin_user = $this->drupalCreateUser([
|
||||
'access administration pages',
|
||||
'administer modules',
|
||||
'administer blocks',
|
||||
'create forum content',
|
||||
]);
|
||||
|
||||
$this->drupalLogin($admin_user);
|
||||
|
||||
|
||||
@@ -189,9 +189,9 @@ class ForumTest extends BrowserTestBase {
|
||||
|
||||
// Verify that this user is shown a local task to add new forum content.
|
||||
$this->drupalGet('forum');
|
||||
$this->assertLink(t('Add new Forum topic'));
|
||||
$this->assertSession()->linkExists(t('Add new Forum topic'));
|
||||
$this->drupalGet('forum/' . $this->forum['tid']);
|
||||
$this->assertLink(t('Add new Forum topic'));
|
||||
$this->assertSession()->linkExists(t('Add new Forum topic'));
|
||||
|
||||
// Log in a user with permission to edit any forum content.
|
||||
$this->drupalLogin($this->editAnyTopicsUser);
|
||||
@@ -224,7 +224,11 @@ class ForumTest extends BrowserTestBase {
|
||||
$this->assertEquals('6', $elements[0]->getText(), 'Number of posts found.');
|
||||
|
||||
// Test loading multiple forum nodes on the front page.
|
||||
$this->drupalLogin($this->drupalCreateUser(['administer content types', 'create forum content', 'post comments']));
|
||||
$this->drupalLogin($this->drupalCreateUser([
|
||||
'administer content types',
|
||||
'create forum content',
|
||||
'post comments',
|
||||
]));
|
||||
$this->drupalPostForm('admin/structure/types/manage/forum', ['options[promote]' => 'promote'], t('Save content type'));
|
||||
$this->createForumTopic($this->forum, FALSE);
|
||||
$this->createForumTopic($this->forum, FALSE);
|
||||
@@ -256,7 +260,7 @@ class ForumTest extends BrowserTestBase {
|
||||
// Test anonymous action link.
|
||||
$this->drupalLogout();
|
||||
$this->drupalGet('forum/' . $this->forum['tid']);
|
||||
$this->assertLink(t('Log in to post new content in the forum.'));
|
||||
$this->assertSession()->linkExists(t('Log in to post new content in the forum.'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -319,8 +323,8 @@ class ForumTest extends BrowserTestBase {
|
||||
// Verify help text is shown.
|
||||
$this->assertText(t('Forums contain forum topics. Use containers to group related forums'));
|
||||
// Verify action links are there.
|
||||
$this->assertLink('Add forum');
|
||||
$this->assertLink('Add container');
|
||||
$this->assertSession()->linkExists('Add forum');
|
||||
$this->assertSession()->linkExists('Add container');
|
||||
$this->clickLink('edit container');
|
||||
$this->assertRaw('Edit container', 'Followed the link to edit the container');
|
||||
// Create forum inside the forum container.
|
||||
@@ -365,7 +369,7 @@ class ForumTest extends BrowserTestBase {
|
||||
// Test tags vocabulary form is not affected.
|
||||
$this->drupalGet('admin/structure/taxonomy/manage/tags');
|
||||
$this->assertSession()->buttonExists('Save');
|
||||
$this->assertLink(t('Delete'));
|
||||
$this->assertSession()->linkExists(t('Delete'));
|
||||
// Test tags vocabulary term form is not affected.
|
||||
$this->drupalGet('admin/structure/taxonomy/manage/tags/add');
|
||||
$this->assertField('parent[]', 'Parent field found.');
|
||||
@@ -547,7 +551,7 @@ class ForumTest extends BrowserTestBase {
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
|
||||
// Verify there is no unintentional HTML tag escaping.
|
||||
$this->assertNoEscaped('<', '');
|
||||
$this->assertNoEscaped('<');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,13 @@ class ForumUninstallTest extends BrowserTestBase {
|
||||
* Tests if forum module uninstallation properly deletes the field.
|
||||
*/
|
||||
public function testForumUninstallWithField() {
|
||||
$this->drupalLogin($this->drupalCreateUser(['administer taxonomy', 'administer nodes', 'administer modules', 'delete any forum content', 'administer content types']));
|
||||
$this->drupalLogin($this->drupalCreateUser([
|
||||
'administer taxonomy',
|
||||
'administer nodes',
|
||||
'administer modules',
|
||||
'delete any forum content',
|
||||
'administer content types',
|
||||
]));
|
||||
// Ensure that the field exists before uninstallation.
|
||||
$field_storage = FieldStorageConfig::loadByName('node', 'taxonomy_forums');
|
||||
$this->assertNotNull($field_storage, 'The taxonomy_forums field storage exists.');
|
||||
@@ -91,7 +97,7 @@ class ForumUninstallTest extends BrowserTestBase {
|
||||
|
||||
// Ensure that the forum node type can not be deleted.
|
||||
$this->drupalGet('admin/structure/types/manage/forum');
|
||||
$this->assertNoLink(t('Delete'));
|
||||
$this->assertSession()->linkNotExists(t('Delete'));
|
||||
|
||||
// Now attempt to uninstall forum.
|
||||
$this->drupalGet('admin/modules/uninstall');
|
||||
|
||||
Reference in New Issue
Block a user