Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 50... Línea 50...
50
    protected function tearDown(): void {
50
    protected function tearDown(): void {
51
        $this->qa = null;
51
        $this->qa = null;
52
        $this->iterator = null;
52
        $this->iterator = null;
53
    }
53
    }
Línea 54... Línea 54...
54
 
54
 
55
    public function test_foreach_loop() {
55
    public function test_foreach_loop(): void {
56
        $i = 0;
56
        $i = 0;
57
        foreach ($this->iterator as $key => $step) {
57
        foreach ($this->iterator as $key => $step) {
58
            $this->assertEquals($i, $key);
58
            $this->assertEquals($i, $key);
59
            $this->assertEquals($i, $step->get_qt_var('i'));
59
            $this->assertEquals($i, $step->get_qt_var('i'));
60
            $i++;
60
            $i++;
61
        }
61
        }
Línea 62... Línea 62...
62
    }
62
    }
63
 
63
 
64
    public function test_foreach_loop_add_step_during() {
64
    public function test_foreach_loop_add_step_during(): void {
65
        $i = 0;
65
        $i = 0;
66
        foreach ($this->iterator as $key => $step) {
66
        foreach ($this->iterator as $key => $step) {
67
            $this->assertEquals($i, $key);
67
            $this->assertEquals($i, $key);
Línea 73... Línea 73...
73
            }
73
            }
74
        }
74
        }
75
        $this->assertEquals(4, $i);
75
        $this->assertEquals(4, $i);
76
    }
76
    }
Línea 77... Línea 77...
77
 
77
 
78
    public function test_reverse_foreach_loop() {
78
    public function test_reverse_foreach_loop(): void {
79
        $i = 2;
79
        $i = 2;
80
        foreach ($this->qa->get_reverse_step_iterator() as $key => $step) {
80
        foreach ($this->qa->get_reverse_step_iterator() as $key => $step) {
81
            $this->assertEquals($i, $key);
81
            $this->assertEquals($i, $key);
82
            $this->assertEquals($i, $step->get_qt_var('i'));
82
            $this->assertEquals($i, $step->get_qt_var('i'));
83
            $i--;
83
            $i--;
84
        }
84
        }
Línea 85... Línea 85...
85
    }
85
    }
86
 
86
 
87
    public function test_offsetExists_before_start() {
87
    public function test_offsetExists_before_start(): void {
Línea 88... Línea 88...
88
        $this->assertFalse(isset($this->iterator[-1]));
88
        $this->assertFalse(isset($this->iterator[-1]));
89
    }
89
    }
90
 
90
 
Línea 91... Línea 91...
91
    public function test_offsetExists_at_start() {
91
    public function test_offsetExists_at_start(): void {
92
        $this->assertTrue(isset($this->iterator[0]));
92
        $this->assertTrue(isset($this->iterator[0]));
93
    }
93
    }
Línea 94... Línea 94...
94
 
94
 
95
    public function test_offsetExists_at_endt() {
95
    public function test_offsetExists_at_endt(): void {
96
        $this->assertTrue(isset($this->iterator[2]));
96
        $this->assertTrue(isset($this->iterator[2]));
Línea 97... Línea 97...
97
    }
97
    }
98
 
98
 
99
    public function test_offsetExists_past_end() {
99
    public function test_offsetExists_past_end(): void {
100
        $this->assertFalse(isset($this->iterator[3]));
100
        $this->assertFalse(isset($this->iterator[3]));
Línea 101... Línea 101...
101
    }
101
    }
102
 
102
 
103
    public function test_offsetGet_before_start() {
103
    public function test_offsetGet_before_start(): void {
104
        $this->expectException(\moodle_exception::class);
104
        $this->expectException(\moodle_exception::class);
Línea 105... Línea 105...
105
        $step = $this->iterator[-1];
105
        $step = $this->iterator[-1];
106
    }
106
    }
107
 
107
 
108
    public function test_offsetGet_at_start() {
108
    public function test_offsetGet_at_start(): void {
Línea 109... Línea 109...
109
        $step = $this->iterator[0];
109
        $step = $this->iterator[0];
110
        $this->assertEquals(0, $step->get_qt_var('i'));
110
        $this->assertEquals(0, $step->get_qt_var('i'));
111
    }
111
    }
112
 
112
 
Línea 113... Línea 113...
113
    public function test_offsetGet_at_end() {
113
    public function test_offsetGet_at_end(): void {
114
        $step = $this->iterator[2];
114
        $step = $this->iterator[2];
115
        $this->assertEquals(2, $step->get_qt_var('i'));
115
        $this->assertEquals(2, $step->get_qt_var('i'));
116
    }
116
    }
Línea 117... Línea 117...
117
 
117
 
118
    public function test_offsetGet_past_end() {
118
    public function test_offsetGet_past_end(): void {
119
        $this->expectException(\moodle_exception::class);
119
        $this->expectException(\moodle_exception::class);
120
        $step = $this->iterator[3];
120
        $step = $this->iterator[3];
121
    }
121
    }