/** * Create temporary test tables and entries in the database for these tests. * These tests have to work on a brand new site. */ public function setUp() { global $CFG; parent::setup(); // All operations until end of test method will happen in test DB $this->switch_to_test_db(); foreach ($this->tables as $dir => $tables) { $this->create_test_tables($tables, $dir); // Create tables foreach ($tables as $table) { // Fill them if load_xxx method is available $function = "load_{$table}"; if (method_exists($this, $function)) { $this->{$function}(); } } } }
/** * Create temporary test tables and entries in the database for these tests. * These tests have to work on a brand new site. */ function setUp() { global $CFG; parent::setup(); $this->switch_to_test_db(); // All operations until end of test method will happen in test DB // additional tables required if ousearch module is present if (ouwiki_search_installed()) { $this->tables['local/ousearch'] = array('local_ousearch_documents', 'local_ousearch_words', 'local_ousearch_occurrences'); } foreach ($this->tables as $dir => $tables) { $this->create_test_tables($tables, $dir); // Create tables foreach ($tables as $table) { // Fill them if load_xxx method is available $function = "load_{$table}"; if (method_exists($this, $function)) { $this->{$function}(); } } } }
/** * Create temporary test tables and entries in the database for these tests. * These tests have to work on a brand new site. */ function setUp() { global $CFG; parent::setup(); $CFG->grade_droplow = -1; $CFG->grade_keephigh = -1; $CFG->grade_aggregation = -1; $CFG->grade_aggregateonlygraded = -1; $CFG->grade_aggregateoutcomes = -1; $CFG->grade_aggregatesubcats = -1; $this->switch_to_test_db(); // All operations until end of test method will happen in test DB foreach ($this->grade_tables as $dir => $tables) { $this->create_test_tables($tables, $dir); // Create tables foreach ($tables as $table) { // Fill them if load_xxx method is available $function = "load_{$table}"; if (method_exists($this, $function)) { $this->{$function}(); } } } }
function setup() { global $USER; parent::setup(); $this->switch_to_test_db(); // Switch to test DB for all the execution foreach ($this->testtables as $dir => $tables) { $this->create_test_tables($tables, $dir); // Create tables } // It is necessary to store $USER object because some subclasses use generator // stuff which breaks $USER $this->olduser = $USER; }
function setup() { parent::setup(); }