| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id$ 3 4 /** 5 * @file 6 * Webform module permission tests. 7 */ 8 9 include_once(dirname(__FILE__) . '/webform.test'); 10 11 class WebformPermissionsTestCase extends WebformTestCase { 12 /** 13 * Implementation of getInfo(). 14 */ 15 public static function getInfo() { 16 return array( 17 'name' => t('Webform permissions'), 18 'description' => t('Create webforms and check editing and access permissions.'), 19 'group' => t('Webform'), 20 ); 21 } 22 23 /** 24 * Implementation of setUp(). 25 */ 26 function setUp() { 27 parent::setUp(); 28 } 29 30 /** 31 * Implementation of tearDown(). 32 */ 33 function tearDown() { 34 parent::tearDown(); 35 } 36 37 /** 38 * Create a webform node in which authenticated users have access to submit. 39 */ 40 function testWebformSubmitAccess() { 41 $this->webformReset(); 42 $node = $this->testWebformForm(); 43 $node->webform['roles'] = array(2); 44 node_save($node); 45 46 // Test that the authenticated user is able to access. 47 $this->drupalLogin($this->webform_users['userAccess']); 48 $this->drupalGet('node/' . $node->nid); 49 $this->assertText($node->body, t('Webform node created and accessible to authenticated users at !url', array('!url' => 'node/' . $node->nid)), t('Webform')); 50 51 // Confirm that the submission has been created. 52 $this->drupalPost(NULL, array(), 'Submit'); 53 $this->assertText($node->webform['confirmation'], t('Confirmation message "@confirmation" received.', array('@confirmation' => $node->webform['confirmation'])), t('Webform')); 54 $this->drupalLogout(); 55 56 // The anonymous user should not be able to submit. 57 $this->drupalGet('node/' . $node->nid); 58 // Note: Should be: You must <a href="!login">login</a> or <a href="!register">register</a> to view this form. 59 // Something in SimpleTest isn't handling the string correctly. 60 $this->assertText('to view this form.', t('Anonymous user is not allowed to submit form.'), t('Webform')); 61 } 62 63 /** 64 * Create webform 65 */ 66 67 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |