Unit tests: show total time taken to run the tests.
[moodle.git] / lib / simpletest / testsimpletestlib.php
CommitLineData
821e4ecf 1<?php
2/**
b1bc1263 3 * Unit tests for (some of) ../simpletestlib.php.
821e4ecf 4 *
821e4ecf 5 * @author T.J.Hunt@open.ac.uk
6 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
b1bc1263 7 * @package SimpleTestEx
821e4ecf 8 */
9
10if (!defined('MOODLE_INTERNAL')) {
11 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
12}
13
58fa5d6f 14class simpletestlib_test extends FakeDBUnitTestCase {
821e4ecf 15
b1bc1263 16 function test_load_delete_test_data() {
821e4ecf 17 global $DB;
821e4ecf 18 $contexts = $this->load_test_data('context',
19 array('contextlevel', 'instanceid', 'path', 'depth'), array(
20 array(10, 666, '', 1),
21 array(40, 666, '', 2),
22 array(50, 666, '', 3),
23 ));
821e4ecf 24
25 // Just test load_test_data and delete_test_data for now.
26 $this->assertTrue($DB->record_exists('context', array('id' => $contexts[1]->id)));
b1bc1263 27 $this->assertTrue($DB->get_field('context', 'contextlevel', array('id' => $contexts[2]->id)), $contexts[2]->contextlevel);
821e4ecf 28 $this->delete_test_data('context', $contexts);
29 $this->assertFalse($DB->record_exists('context', array('id' => $contexts[1]->id)));
30 }
31}
b1bc1263 32
821e4ecf 33?>