1 |
efrain |
1 |
<?php
|
|
|
2 |
// This file is part of Moodle - http://moodle.org/
|
|
|
3 |
//
|
|
|
4 |
// Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
// it under the terms of the GNU General Public License as published by
|
|
|
6 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
// (at your option) any later version.
|
|
|
8 |
//
|
|
|
9 |
// Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
// GNU General Public License for more details.
|
|
|
13 |
//
|
|
|
14 |
// You should have received a copy of the GNU General Public License
|
|
|
15 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* PHPUnit tool_brickfield tests
|
|
|
19 |
*
|
|
|
20 |
* @package tool_brickfield
|
|
|
21 |
* @copyright 2020 onward: Brickfield Education Labs, www.brickfield.ie
|
|
|
22 |
* @author Mike Churchward (mike@brickfieldlabs.ie)
|
|
|
23 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
24 |
*/
|
|
|
25 |
|
|
|
26 |
namespace tool_brickfield;
|
|
|
27 |
|
|
|
28 |
defined('MOODLE_INTERNAL') || die();
|
|
|
29 |
|
|
|
30 |
global $CFG;
|
|
|
31 |
require_once($CFG->dirroot . '/admin/tool/brickfield/tests/generator/mock_brickfieldconnect.php');
|
|
|
32 |
|
|
|
33 |
/**
|
|
|
34 |
* Mock registration.
|
|
|
35 |
*/
|
|
|
36 |
class mock_registration extends registration {
|
|
|
37 |
/**
|
|
|
38 |
* Get registration connection.
|
|
|
39 |
* @return brickfieldconnect
|
|
|
40 |
*/
|
|
|
41 |
protected function get_registration_connection(): brickfieldconnect {
|
|
|
42 |
return new mock_brickfieldconnect();
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
/**
|
|
|
46 |
* Is not entered.
|
|
|
47 |
* @return bool
|
|
|
48 |
*/
|
|
|
49 |
public function is_not_entered() {
|
|
|
50 |
return $this->status_is_not_entered();
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
/**
|
|
|
54 |
* Invalidate validation time.
|
|
|
55 |
* @return int
|
|
|
56 |
* @throws \dml_exception
|
|
|
57 |
*/
|
|
|
58 |
public function invalidate_validation_time() {
|
|
|
59 |
$this->set_validation_time(time() - (7 * 24 * 60 * 60));
|
|
|
60 |
return $this->get_validation_time();
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
/**
|
|
|
64 |
* Invalidate summary time.
|
|
|
65 |
* @return int
|
|
|
66 |
* @throws \dml_exception
|
|
|
67 |
*/
|
|
|
68 |
public function invalidate_summary_time() {
|
|
|
69 |
$this->set_summary_time(time() - (7 * 24 * 60 * 60) - 1);
|
|
|
70 |
return $this->get_summary_time();
|
|
|
71 |
}
|
|
|
72 |
}
|