Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 11
Línea 32... Línea 32...
32
 * @category   test
32
 * @category   test
33
 * @copyright  2008 The Open University
33
 * @copyright  2008 The Open University
34
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
34
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
35
 */
35
 */
36
class rule_test extends \basic_testcase {
36
class rule_test extends \basic_testcase {
37
    public function test_just_first_delay() {
37
    public function test_just_first_delay(): void {
38
        $quiz = new \stdClass();
38
        $quiz = new \stdClass();
39
        $quiz->attempts = 3;
39
        $quiz->attempts = 3;
40
        $quiz->timelimit = 0;
40
        $quiz->timelimit = 0;
41
        $quiz->delay1 = 1000;
41
        $quiz->delay1 = 1000;
42
        $quiz->delay2 = 0;
42
        $quiz->delay2 = 0;
Línea 66... Línea 66...
66
        $this->assertEquals($rule->prevent_new_attempt(1, $attempt),
66
        $this->assertEquals($rule->prevent_new_attempt(1, $attempt),
67
            get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(10001)));
67
            get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(10001)));
68
        $this->assertFalse($rule->prevent_new_attempt(2, $attempt));
68
        $this->assertFalse($rule->prevent_new_attempt(2, $attempt));
69
    }
69
    }
Línea 70... Línea 70...
70
 
70
 
71
    public function test_just_second_delay() {
71
    public function test_just_second_delay(): void {
72
        $quiz = new \stdClass();
72
        $quiz = new \stdClass();
73
        $quiz->attempts = 5;
73
        $quiz->attempts = 5;
74
        $quiz->timelimit = 0;
74
        $quiz->timelimit = 0;
75
        $quiz->delay1 = 0;
75
        $quiz->delay1 = 0;
Línea 105... Línea 105...
105
            get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(10001)));
105
            get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(10001)));
106
        $this->assertEquals($rule->prevent_new_attempt(4, $attempt),
106
        $this->assertEquals($rule->prevent_new_attempt(4, $attempt),
107
            get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(10001)));
107
            get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(10001)));
108
    }
108
    }
Línea 109... Línea 109...
109
 
109
 
110
    public function test_just_both_delays() {
110
    public function test_just_both_delays(): void {
111
        $quiz = new \stdClass();
111
        $quiz = new \stdClass();
112
        $quiz->attempts = 5;
112
        $quiz->attempts = 5;
113
        $quiz->timelimit = 0;
113
        $quiz->timelimit = 0;
114
        $quiz->delay1 = 2000;
114
        $quiz->delay1 = 2000;
Línea 156... Línea 156...
156
            get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(10001)));
156
            get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(10001)));
157
        $this->assertEquals($rule->prevent_new_attempt(4, $attempt),
157
        $this->assertEquals($rule->prevent_new_attempt(4, $attempt),
158
            get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(10001)));
158
            get_string('youmustwait', 'quizaccess_delaybetweenattempts', userdate(10001)));
159
    }
159
    }
Línea 160... Línea 160...
160
 
160
 
161
    public function test_with_close_date() {
161
    public function test_with_close_date(): void {
162
        $quiz = new \stdClass();
162
        $quiz = new \stdClass();
163
        $quiz->attempts = 5;
163
        $quiz->attempts = 5;
164
        $quiz->timelimit = 0;
164
        $quiz->timelimit = 0;
165
        $quiz->delay1 = 2000;
165
        $quiz->delay1 = 2000;
Línea 212... Línea 212...
212
        $this->assertFalse($rule->prevent_new_attempt(2, $attempt));
212
        $this->assertFalse($rule->prevent_new_attempt(2, $attempt));
213
        $attempt->timefinish = 14001;
213
        $attempt->timefinish = 14001;
214
        $this->assertFalse($rule->prevent_new_attempt(2, $attempt));
214
        $this->assertFalse($rule->prevent_new_attempt(2, $attempt));
215
    }
215
    }
Línea 216... Línea 216...
216
 
216
 
217
    public function test_time_limit_and_overdue() {
217
    public function test_time_limit_and_overdue(): void {
218
        $quiz = new \stdClass();
218
        $quiz = new \stdClass();
219
        $quiz->attempts = 5;
219
        $quiz->attempts = 5;
220
        $quiz->timelimit = 100;
220
        $quiz->timelimit = 100;
221
        $quiz->delay1 = 2000;
221
        $quiz->delay1 = 2000;