/[drupal]/contributions/sandbox/deekayen/modules/dpistudy/tests/ugrd.test
ViewVC logotype

Contents of /contributions/sandbox/deekayen/modules/dpistudy/tests/ugrd.test

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Wed Apr 16 05:42:50 2008 UTC (19 months, 1 week ago) by deekayen
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +8 -31 lines
File MIME type: text/x-php
fixed missing countdown titles on instruction pages, figured out why hook_install() wasn't setting the results page text during install, moved the javascript timer around in the code, updated concat coder formatting to match new D7 standards, moved csv output to a new report screen, updated simpletests to match changes, customized an image I didn't end up getting copyright permission to reprint, and I think it might be ready to launch
1 <?php
2 // $Id$
3
4 class DPIStudyUndergradTest extends DrupalTestCase {
5 function get_info() {
6 return array(
7 'name' => t('Undergrad'),
8 'desc' => t('Do a run through the DPI study as an undergraduate.'),
9 'group' => 'DPI Study'
10 );
11 }
12
13 function setUp() {
14 parent::setUp();
15
16 $this->drupalModuleEnable('dpistudy');
17 $this->drupalVariableSet('dpistudy_irb_consent_active', '1');
18 }
19
20 function tearDown() {
21 parent::tearDown();
22 }
23
24 function testParticipate() {
25
26 $url = $this->drupalGet('/dpistudy/?k=ugrd');
27
28 $session_id = getCookie('sessid');
29
30 $this->assertText('Get your Digital Propensity Index score!');
31 $this->assertText('not sure. Take me somewhere else.');
32
33 $this->clickSubmit(t('I consent'));
34
35 $this->assertText('Digital Propensity Index Questionnaire');
36
37 // 0 should unset the field as if the question was omitted by the participant
38 for ($i=1; $i<47; $this->setField("question_$i", rand(0, 3)), $i++);
39
40 $this->clickSubmit(t('Submit'));
41
42 for ($i=5; $i>=1; $i--) {
43 $this->assertText(t('Just @num more!', array('@num' => $i)));
44 $this->assertText(t('This question is timed'));
45 $this->clickSubmit(t('Submit'));
46 }
47 $this->assertText(t('Last one!'));
48 $this->assertText(t('This question is timed'));
49 $this->clickSubmit(t('Submit'));
50
51 $this->assertText(t('Your Digital Propensity Index score!'));
52 $this->assertPattern(t('/Your Digital Propensity Index score is <strong>\d+<\/strong>\. A score of \d+ would represent the far extreme Digital Immigrant as opposed to the other extreme of \d+ for a pure Digital Native\./'));
53
54 $url = url('logout', array('absolute' => TRUE));
55 $this->get($url);
56 }
57 }

  ViewVC Help
Powered by ViewVC 1.1.2