12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- /**
- * @file
- * Webform module permission tests.
- */
- include_once(dirname(__FILE__) . '/webform.test');
- class WebformPermissionsTestCase extends WebformTestCase {
- /**
- * Implements getInfo().
- */
- public static function getInfo() {
- return array(
- 'name' => t('Webform permissions'),
- 'description' => t('Create webforms and check editing and access permissions.'),
- 'group' => t('Webform'),
- );
- }
- /**
- * Implements setUp().
- */
- function setUp() {
- parent::setUp();
- }
- /**
- * Implements tearDown().
- */
- function tearDown() {
- parent::tearDown();
- }
- /**
- * Create a webform node in which authenticated users have access to submit.
- */
- function testWebformSubmitAccess() {
- $this->webformReset();
- $node = $this->testWebformForm();
- $node->webform['roles'] = array(2);
- node_save($node);
- // Test that the authenticated user is able to access.
- $this->drupalLogin($this->webform_users['userAccess']);
- $this->drupalGet('node/' . $node->nid);
- $this->assertText($node->body[LANGUAGE_NONE][0]['value'], t('Webform node created and accessible to authenticated users at !url', array('!url' => 'node/' . $node->nid)), t('Webform'));
- // Confirm that the submission has been created.
- $this->drupalPost(NULL, array(), 'Submit');
- $this->assertText($node->webform['confirmation'], t('Confirmation message "@confirmation" received.', array('@confirmation' => $node->webform['confirmation'])), t('Webform'));
- $this->drupalLogout();
- // The anonymous user should not be able to submit.
- $this->drupalGet('node/' . $node->nid);
- // Note: Should be: You must <a href="!login">login</a> or <a href="!register">register</a> to view this form.
- // Something in SimpleTest isn't handling the string correctly.
- $this->assertText('to view this form.', t('Anonymous user is not allowed to submit form.'), t('Webform'));
- }
- /**
- * Create webform
- */
- }
|