File tree Expand file tree Collapse file tree 4 files changed +27
-5
lines changed Expand file tree Collapse file tree 4 files changed +27
-5
lines changed Original file line number Diff line number Diff line change 1
- 4.0.2
1
+ 4.0.3
Original file line number Diff line number Diff line change @@ -159,12 +159,14 @@ protected function _search()
159
159
}
160
160
161
161
/**
162
+ * @param Integer $time_limit seconds before question set expires.
163
+ *
162
164
* @return QuestionSet The created QuestionSet.
163
165
*/
164
- protected function _createQuestionSet ()
166
+ protected function _createQuestionSet ($ time_limit )
165
167
{
166
168
$ url = static ::classUrl ();
167
- $ params = array ('person_id ' => $ this ->id );
169
+ $ params = array ('person_id ' => $ this ->id , ' time_limit ' => $ time_limit );
168
170
$ response = static ::_makeRequest ('post ' , $ url , $ params );
169
171
$ qs_obj = Util \Util::convertToBlockScoreObject ($ response );
170
172
$ this ->addExisting ($ qs_obj );
Original file line number Diff line number Diff line change @@ -18,11 +18,13 @@ public function __construct($id)
18
18
}
19
19
20
20
/**
21
+ * @param Integer $time_limit seconds before question set expires.
22
+ *
21
23
* @return QuestionSet The created QuestionSet.
22
24
*/
23
- public function create ()
25
+ public function create ($ time_limit = 0 )
24
26
{
25
- return self ::_createQuestionSet ();
27
+ return self ::_createQuestionSet ($ time_limit );
26
28
}
27
29
28
30
/**
Original file line number Diff line number Diff line change @@ -35,6 +35,24 @@ public function testCreateQuestionSet()
35
35
}
36
36
}
37
37
38
+ public function testCreateQuestionSetWithTimeLimit ()
39
+ {
40
+ $ person = self ::createTestPerson ();
41
+ $ qs = $ person ->question_sets ->create (17 );
42
+
43
+ $ this ->assertSame ($ qs ->time_limit , 17 );
44
+ }
45
+
46
+ public function testTimeLimitExpired ()
47
+ {
48
+ $ person = self ::createTestPerson ();
49
+ $ qs = $ person ->question_sets ->create (2 );
50
+ sleep (4 );
51
+
52
+ $ retrieved_qs = $ person ->question_sets ->retrieve ($ qs ->id );
53
+ $ this ->assertSame ($ retrieved_qs ->expired , true );
54
+ }
55
+
38
56
public function testAllQuestionSet ()
39
57
{
40
58
$ person = self ::createTestPerson ();
You can’t perform that action at this time.
0 commit comments