Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 54... Línea 54...
54
    protected function tearDown(): void {
54
    protected function tearDown(): void {
55
        $this->quba = null;
55
        $this->quba = null;
56
        $this->iterator = null;
56
        $this->iterator = null;
57
    }
57
    }
Línea 58... Línea 58...
58
 
58
 
59
    public function test_foreach_loop() {
59
    public function test_foreach_loop(): void {
60
        $i = 1;
60
        $i = 1;
61
        foreach ($this->iterator as $key => $qa) {
61
        foreach ($this->iterator as $key => $qa) {
62
            $this->assertEquals($i, $key);
62
            $this->assertEquals($i, $key);
63
            $this->assertSame($this->qas[$i], $qa);
63
            $this->assertSame($this->qas[$i], $qa);
64
            $i++;
64
            $i++;
65
        }
65
        }
66
        $this->assertEquals(3, $i);
66
        $this->assertEquals(3, $i);
Línea 67... Línea 67...
67
    }
67
    }
68
 
68
 
69
    public function test_offsetExists_before_start() {
69
    public function test_offsetExists_before_start(): void {
Línea 70... Línea 70...
70
        $this->assertFalse(isset($this->iterator[0]));
70
        $this->assertFalse(isset($this->iterator[0]));
71
    }
71
    }
72
 
72
 
Línea 73... Línea 73...
73
    public function test_offsetExists_at_start() {
73
    public function test_offsetExists_at_start(): void {
74
        $this->assertTrue(isset($this->iterator[1]));
74
        $this->assertTrue(isset($this->iterator[1]));
75
    }
75
    }
Línea 76... Línea 76...
76
 
76
 
77
    public function test_offsetExists_at_endt() {
77
    public function test_offsetExists_at_endt(): void {
78
        $this->assertTrue(isset($this->iterator[2]));
78
        $this->assertTrue(isset($this->iterator[2]));
Línea 79... Línea 79...
79
    }
79
    }
80
 
80
 
81
    public function test_offsetExists_past_end() {
81
    public function test_offsetExists_past_end(): void {
82
        $this->assertFalse(isset($this->iterator[3]));
82
        $this->assertFalse(isset($this->iterator[3]));
Línea 83... Línea 83...
83
    }
83
    }
84
 
84
 
85
    public function test_offsetGet_before_start() {
85
    public function test_offsetGet_before_start(): void {
Línea 86... Línea 86...
86
        $this->expectException(\moodle_exception::class);
86
        $this->expectException(\moodle_exception::class);
87
        $step = $this->iterator[0];
87
        $step = $this->iterator[0];
88
    }
88
    }
Línea 89... Línea 89...
89
 
89
 
90
    public function test_offsetGet_at_start() {
90
    public function test_offsetGet_at_start(): void {
91
        $this->assertSame($this->qas[1], $this->iterator[1]);
91
        $this->assertSame($this->qas[1], $this->iterator[1]);
92
    }
92
    }
Línea 93... Línea 93...
93
 
93
 
94
    public function test_offsetGet_at_end() {
94
    public function test_offsetGet_at_end(): void {
95
        $this->assertSame($this->qas[2], $this->iterator[2]);
95
        $this->assertSame($this->qas[2], $this->iterator[2]);
96
    }
96
    }
Línea 97... Línea 97...
97
 
97
 
98
    public function test_offsetGet_past_end() {
98
    public function test_offsetGet_past_end(): void {
99
        $this->expectException(\moodle_exception::class);
99
        $this->expectException(\moodle_exception::class);
100
        $step = $this->iterator[3];
100
        $step = $this->iterator[3];
101
    }
101
    }