ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
AttemptResultTest.php
Go to the documentation of this file.
1<?php
2
20
23
25{
26 public static function getSettingsDataProvider(): array
27 {
28 return [
29 [new \ilTestPass()]
30 ];
31 }
32
33 #[\PHPUnit\Framework\Attributes\DataProvider('getActiveIdDataProvider')]
34 public function testGetActiveId(int $IO): void
35 {
36 $ilTestPassResult = new AttemptSolutions(
37 $IO,
38 0,
39 []
40 );
41 $this->assertEquals($IO, $ilTestPassResult->getActiveId());
42 }
43
44 public static function getActiveIdDataProvider(): array
45 {
46 return [
47 [-1],
48 [0],
49 [1]
50 ];
51 }
52
53 #[\PHPUnit\Framework\Attributes\DataProvider('getPassDataProvider')]
54 public function testGetAttempt(int $IO): void
55 {
56 $ilTestPassResult = new AttemptSolutions(
57 0,
58 $IO,
59 []
60 );
61 $this->assertEquals($IO, $ilTestPassResult->getAttempt());
62 }
63
64 public static function getPassDataProvider(): array
65 {
66 return [
67 [-1],
68 [0],
69 [1]
70 ];
71 }
72
73 #[\PHPUnit\Framework\Attributes\DataProvider('getQuestionResultsDataProvider')]
74 public function testGetQuestionResults(\Closure $IO): void
75 {
76 $IO = $IO($this);
77 $ilTestPassResult = new AttemptSolutions(
78 0,
79 0,
80 $IO
81 );
82 $this->assertEquals($IO, $ilTestPassResult->getQuestionResults());
83 }
84
85 public static function getQuestionResultsDataProvider(): array
86 {
87 return [
88 [static fn(self $test_case): array => []],
89 [static fn(self $test_case): array => [
90 $test_case->createMock(QuestionResult::class)
91 ]],
92 [static fn(self $test_case): array => [
93 $test_case->createMock(QuestionResult::class),
94 $test_case->createMock(QuestionResult::class),
95 ]]
96 ];
97
98 }
99}
Class ilTestBaseClass.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...