Línea 125... |
Línea 125... |
125 |
* @covers ::has_completion
|
125 |
* @covers ::has_completion
|
126 |
* @dataProvider has_completion_provider
|
126 |
* @dataProvider has_completion_provider
|
127 |
* @param int $completion The completion tracking mode.
|
127 |
* @param int $completion The completion tracking mode.
|
128 |
* @param bool $expectedresult Expected result.
|
128 |
* @param bool $expectedresult Expected result.
|
129 |
*/
|
129 |
*/
|
130 |
public function test_has_completion(int $completion, bool $expectedresult) {
|
130 |
public function test_has_completion(int $completion, bool $expectedresult): void {
|
131 |
$cmcompletion = $this->setup_data($completion);
|
131 |
$cmcompletion = $this->setup_data($completion);
|
Línea 132... |
Línea 132... |
132 |
|
132 |
|
133 |
$this->assertEquals($expectedresult, $cmcompletion->has_completion());
|
133 |
$this->assertEquals($expectedresult, $cmcompletion->has_completion());
|
Línea 158... |
Línea 158... |
158 |
* @covers ::is_automatic
|
158 |
* @covers ::is_automatic
|
159 |
* @dataProvider is_automatic_provider
|
159 |
* @dataProvider is_automatic_provider
|
160 |
* @param int $completion The completion tracking mode.
|
160 |
* @param int $completion The completion tracking mode.
|
161 |
* @param bool $expectedresult Expected result.
|
161 |
* @param bool $expectedresult Expected result.
|
162 |
*/
|
162 |
*/
|
163 |
public function test_is_automatic(int $completion, bool $expectedresult) {
|
163 |
public function test_is_automatic(int $completion, bool $expectedresult): void {
|
164 |
$cmcompletion = $this->setup_data($completion);
|
164 |
$cmcompletion = $this->setup_data($completion);
|
Línea 165... |
Línea 165... |
165 |
|
165 |
|
166 |
$this->assertEquals($expectedresult, $cmcompletion->is_automatic());
|
166 |
$this->assertEquals($expectedresult, $cmcompletion->is_automatic());
|
Línea 191... |
Línea 191... |
191 |
* @covers ::is_manual
|
191 |
* @covers ::is_manual
|
192 |
* @dataProvider is_manual_provider
|
192 |
* @dataProvider is_manual_provider
|
193 |
* @param int $completion The completion tracking mode.
|
193 |
* @param int $completion The completion tracking mode.
|
194 |
* @param bool $expectedresult Expected result.
|
194 |
* @param bool $expectedresult Expected result.
|
195 |
*/
|
195 |
*/
|
196 |
public function test_is_manual(int $completion, bool $expectedresult) {
|
196 |
public function test_is_manual(int $completion, bool $expectedresult): void {
|
197 |
$cmcompletion = $this->setup_data($completion);
|
197 |
$cmcompletion = $this->setup_data($completion);
|
Línea 198... |
Línea 198... |
198 |
|
198 |
|
199 |
$this->assertEquals($expectedresult, $cmcompletion->is_manual());
|
199 |
$this->assertEquals($expectedresult, $cmcompletion->is_manual());
|
Línea 215... |
Línea 215... |
215 |
*
|
215 |
*
|
216 |
* @covers ::get_overall_completion
|
216 |
* @covers ::get_overall_completion
|
217 |
* @dataProvider overall_completion_provider
|
217 |
* @dataProvider overall_completion_provider
|
218 |
* @param int $state
|
218 |
* @param int $state
|
219 |
*/
|
219 |
*/
|
220 |
public function test_get_overall_completion(int $state) {
|
220 |
public function test_get_overall_completion(int $state): void {
|
221 |
$completiondata = (object)['completionstate' => $state];
|
221 |
$completiondata = (object)['completionstate' => $state];
|
222 |
$cmcompletion = $this->setup_data(COMPLETION_TRACKING_AUTOMATIC, [], $completiondata);
|
222 |
$cmcompletion = $this->setup_data(COMPLETION_TRACKING_AUTOMATIC, [], $completiondata);
|
223 |
$this->assertEquals($state, $cmcompletion->get_overall_completion());
|
223 |
$this->assertEquals($state, $cmcompletion->get_overall_completion());
|
224 |
}
|
224 |
}
|
Línea 495... |
Línea 495... |
495 |
* @param int|null $completiongrade Completion status of the "must receive grade" completion condition.
|
495 |
* @param int|null $completiongrade Completion status of the "must receive grade" completion condition.
|
496 |
* @param int|null $completionpassgrade Completion status of the "must receive passing grade" completion condition.
|
496 |
* @param int|null $completionpassgrade Completion status of the "must receive passing grade" completion condition.
|
497 |
* @param array $expecteddetails Expected completion details returned by get_details().
|
497 |
* @param array $expecteddetails Expected completion details returned by get_details().
|
498 |
*/
|
498 |
*/
|
499 |
public function test_get_details(int $completion, ?int $completionview,
|
499 |
public function test_get_details(int $completion, ?int $completionview,
|
500 |
?int $completiongrade, ?int $completionpassgrade, array $expecteddetails) {
|
500 |
?int $completiongrade, ?int $completionpassgrade, array $expecteddetails): void {
|
501 |
$options = [];
|
501 |
$options = [];
|
502 |
$getdatareturn = (object)[
|
502 |
$getdatareturn = (object)[
|
503 |
'viewed' => $completionview,
|
503 |
'viewed' => $completionview,
|
504 |
'completiongrade' => $completiongrade,
|
504 |
'completiongrade' => $completiongrade,
|
505 |
'passgrade' => $completionpassgrade,
|
505 |
'passgrade' => $completionpassgrade,
|
Línea 595... |
Línea 595... |
595 |
* @param array $customcompletionrules Custom completion requirements, along with their values.
|
595 |
* @param array $customcompletionrules Custom completion requirements, along with their values.
|
596 |
* @param string $modname The name of the module having data fetched.
|
596 |
* @param string $modname The name of the module having data fetched.
|
597 |
* @param array $expectedorder The expected order of completion conditions returned about the module.
|
597 |
* @param array $expectedorder The expected order of completion conditions returned about the module.
|
598 |
*/
|
598 |
*/
|
599 |
public function test_get_details_custom_order(bool $completionview, bool $completiongrade, array $customcompletionrules,
|
599 |
public function test_get_details_custom_order(bool $completionview, bool $completiongrade, array $customcompletionrules,
|
600 |
string $modname, array $expectedorder) {
|
600 |
string $modname, array $expectedorder): void {
|
Línea 601... |
Línea 601... |
601 |
|
601 |
|
602 |
$options['customcompletion'] = [];
|
602 |
$options['customcompletion'] = [];
|
Línea 603... |
Línea 603... |
603 |
$customcompletiondata = [];
|
603 |
$customcompletiondata = [];
|