Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 11
Línea 29... Línea 29...
29
class progress_test extends \basic_testcase {
29
class progress_test extends \basic_testcase {
Línea 30... Línea 30...
30
 
30
 
31
    /**
31
    /**
32
     * Tests for basic use with simple numeric progress.
32
     * Tests for basic use with simple numeric progress.
33
     */
33
     */
34
    public function test_basic() {
34
    public function test_basic(): void {
Línea 35... Línea 35...
35
        $progress = new core_mock_progress();
35
        $progress = new core_mock_progress();
36
 
36
 
Línea 76... Línea 76...
76
    }
76
    }
Línea 77... Línea 77...
77
 
77
 
78
    /**
78
    /**
79
     * Tests progress that is nested and/or indeterminate.
79
     * Tests progress that is nested and/or indeterminate.
80
     */
80
     */
81
    public function test_nested() {
81
    public function test_nested(): void {
82
        // Outer progress goes from 0 to 10.
82
        // Outer progress goes from 0 to 10.
83
        $progress = new core_mock_progress();
83
        $progress = new core_mock_progress();
Línea 84... Línea 84...
84
        $progress->start_progress('hello', 10);
84
        $progress->start_progress('hello', 10);
Línea 154... Línea 154...
154
    }
154
    }
Línea 155... Línea 155...
155
 
155
 
156
    /**
156
    /**
157
     * Tests the feature for 'weighting' nested progress.
157
     * Tests the feature for 'weighting' nested progress.
158
     */
158
     */
159
    public function test_nested_weighted() {
159
    public function test_nested_weighted(): void {
160
        $progress = new core_mock_progress();
160
        $progress = new core_mock_progress();
Línea 161... Línea 161...
161
        $progress->start_progress('', 10);
161
        $progress->start_progress('', 10);
162
 
162
 
Línea 187... Línea 187...
187
 
187
 
188
    /**
188
    /**
189
     * I had some issues with real use in backup/restore, this test is intended
189
     * I had some issues with real use in backup/restore, this test is intended
190
     * to be similar.
190
     * to be similar.
191
     */
191
     */
192
    public function test_realistic() {
192
    public function test_realistic(): void {
193
        $progress = new core_mock_progress();
193
        $progress = new core_mock_progress();
194
        $progress->start_progress('parent', 100);
194
        $progress->start_progress('parent', 100);
195
        $progress->start_progress('child', 1);
195
        $progress->start_progress('child', 1);
196
        $progress->progress(1);
196
        $progress->progress(1);
Línea 201... Línea 201...
201
 
201
 
202
    /**
202
    /**
203
     * To avoid causing problems, progress needs to work for sections that have
203
     * To avoid causing problems, progress needs to work for sections that have
204
     * zero entries.
204
     * zero entries.
205
     */
205
     */
206
    public function test_zero() {
206
    public function test_zero(): void {
207
        $progress = new core_mock_progress();
207
        $progress = new core_mock_progress();
208
        $progress->start_progress('parent', 100);
208
        $progress->start_progress('parent', 100);
209
        $progress->progress(1);
209
        $progress->progress(1);
210
        $this->assert_min_max(0.01, 0.01, $progress);
210
        $this->assert_min_max(0.01, 0.01, $progress);
Línea 220... Línea 220...
220
    }
220
    }
Línea 221... Línea 221...
221
 
221
 
222
    /**
222
    /**
223
     * Tests for any exceptions due to invalid calls.
223
     * Tests for any exceptions due to invalid calls.
224
     */
224
     */
225
    public function test_exceptions() {
225
    public function test_exceptions(): void {
Línea 226... Línea 226...
226
        $progress = new core_mock_progress();
226
        $progress = new core_mock_progress();
227
 
227
 
228
        // Check errors when empty.
228
        // Check errors when empty.
Línea 313... Línea 313...
313
        } catch (\coding_exception $e) {
313
        } catch (\coding_exception $e) {
314
            $this->assertEquals(1, preg_match('~would exceed max~', $e->getMessage()));
314
            $this->assertEquals(1, preg_match('~would exceed max~', $e->getMessage()));
315
        }
315
        }
316
    }
316
    }
Línea 317... Línea 317...
317
 
317
 
Línea 318... Línea 318...
318
    public function test_progress_change() {
318
    public function test_progress_change(): void {
Línea 319... Línea 319...
319
 
319