updated webform & faq

This commit is contained in:
2020-03-27 14:25:57 +01:00
parent 1e27fcca51
commit be549a75f6
35 changed files with 569 additions and 239 deletions
+15 -15
View File
@@ -172,20 +172,20 @@ class FaqAccessTestClass extends FaqTestCase {
function testFaqAccess() {
// Verify that anonymous user has no access to the faq page
$this->faqVerifyNoAccess('faq-page');
$this->faqVerifyNoAccess(_faq_path());
// Create and login user
$normal_user = $this->drupalCreateUser();
$this->drupalLogin($normal_user);
// Verify that logged in user has no access to the faq page
$this->faqVerifyNoAccess('faq-page');
$this->faqVerifyNoAccess(_faq_path());
$this->drupalLogout();
$view_faq_user = $this->drupalCreateUser(array('view faq page'));
$this->drupalLogin($view_faq_user);
// Verify that the faq page is visible and available but empty
$this->drupalGet('faq-page');
$this->drupalGet(_faq_path());
$this->assertText(t('Frequently Asked Questions'), t('FAQ page is available for view faq page permissions.'));
}
@@ -217,14 +217,14 @@ class CreateFaqTestCase extends FaqTestCase {
// Show the detailed question
$this->drupalGet('admin/config/content/faq/questions');
// Set faq to allow long question text and labeled questions and answers
$this->drupalPost('admin/config/content/faq/questions', array('faq_question_long_form' => '1', 'faq_qa_mark' => '1'), t('Save configuration'));
$this->drupalPost('admin/config/content/faq/questions', array('faq_question_length' => 'both'), t('Save configuration'));
$this->drupalPost('admin/config/content/faq/questions', array('faq_question_long_form' => '1', 'faq_qa_mark' => '1'), t('Save configuration'));
$this->drupalPost('admin/config/content/faq/questions', array('faq_question_length' => 'both'), t('Save configuration'));
$this->afaq_user = $this->drupalCreateUser(array('create faq content', 'view faq page'));
$this->drupalLogin($this->afaq_user);
$this->afaq_user = $this->drupalCreateUser(array('create faq content', 'view faq page'));
$this->drupalLogin($this->afaq_user);
// Verify that the faq page is visible and available but empty
$this->drupalGet('faq-page');
$this->drupalGet(_faq_path());
$this->assertText(t('Frequently Asked Questions'), t('FAQ page is available for view faq page permissions.'));
// Fill in the Create FAQ node 1 form and post it
@@ -242,7 +242,7 @@ class CreateFaqTestCase extends FaqTestCase {
// Check that faq is found on the correct taxonomy term page too
$this->drupalGet('taxonomy/term/' . $this->term->tid);
$this->assertText(t('@title', array('@title' => $this->faq1['title'])));
$this->assertText(t('@title', array('@title' => $this->faq1['title'])));
// Fill in the Create FAQ node 2 form and post it
$this->faq2 = array();
@@ -261,12 +261,12 @@ class CreateFaqTestCase extends FaqTestCase {
// Verify that logged in user has no access to the faq page
$this->faqVerifyNoAccess('faq-page');
$this->faqVerifyNoAccess(_faq_path());
// Check that the FAQ page is available and that the correct term is listed as grouping for the new FAQ node
$view_faq_user = $this->drupalCreateUser(array('view faq page'));
$this->drupalLogin($view_faq_user);
$this->drupalGet('faq-page');
$this->drupalGet(_faq_path());
$this->assertText(t('Frequently Asked Questions'), t('FAQ page is available for view faq page permissions.'));
$this->assertText($this->faq1['title'], t('Created FAQ node 1 available on FAQ page.'));
$this->assertText($this->faq1[$this->instance['field_name'] . '[' . $langcode .']'], t('Term for node 1 available on FAQ page.'));
@@ -276,7 +276,7 @@ class CreateFaqTestCase extends FaqTestCase {
// Navigate to FAQ node created on FAQ page
$this->clickLink(t($this->faq1['title']));
$this->assertText(t($this->faq1["field_detailed_question[$langcode][0][value]"]), t('Detailed question visible')); // Dependant on the question setting
$this->assertText(t($this->faq1["body[$langcode][0][value]"]), t('Answer visible'));
$this->assertText(t($this->faq1["body[$langcode][0][value]"]), t('Answer visible'));
// Enable categorisation of FAQ nodes
// Create and log in user with create and administer FAQ permissions
@@ -290,7 +290,7 @@ class CreateFaqTestCase extends FaqTestCase {
$this->drupalLogout();
$this->drupalLogin($view_faq_user);
$this->drupalGet('faq-page');
$this->drupalGet(_faq_path());
$this->assertText(t('Frequently Asked Questions'), t('FAQ page is available for view faq page permissions.'));
$this->assertText($this->faq1['title'], t('Created FAQ node 1 available on FAQ page.'));
$this->assertText($this->faq1[$this->instance['field_name'] . '[' . $langcode .']'], t('Term for node 1 not available on FAQ page.'));
@@ -323,7 +323,7 @@ class CRAUDFaqTestCase extends FaqTestCase {
public function testFaqCreate() {
// Verify that logged in user has no access to the faq page
$this->faqVerifyNoAccess('faq-page');
$this->faqVerifyNoAccess(_faq_path());
// Log in user with create FAQ permissions
$this->drupalLogin($this->faq_user);
@@ -353,7 +353,7 @@ class CRAUDFaqTestCase extends FaqTestCase {
$this->drupalLogin($faq_view_user);
// Verify visibility on faq page
$this->drupalGet('faq-page'); // Load faq page
$this->drupalGet(_faq_path()); // Load faq page
$this->assertText($edit['title']); // Node should be listed here
$this->drupalGet('node/' . $node->nid); // It should also be possible to open the node directly