]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15094 removed remaining references to $db
authorskodak <skodak>
Sun, 15 Jun 2008 12:34:08 +0000 (12:34 +0000)
committerskodak <skodak>
Sun, 15 Jun 2008 12:34:08 +0000 (12:34 +0000)
lib/dml/moodle_database.php
lib/simpletest/testbackuplib.php

index 9fbc12a7873b07170c5b1b134eb7e21676913f68..db6e0fd72aee58d5ebe96c9e4314310116ffd26c 100644 (file)
@@ -1245,7 +1245,7 @@ abstract class moodle_database {
 
     /**
      * Returns the proper substr() function for each DB
-     * Relies on ADOdb $db->substr property
+     * Relies on ADOdb $adodb->substr property
      */
     public abstract function sql_substr();
 
index 59646319210a69491270df75026a98b1a24d8ca9..f6f8d8fbfb2ae796315d66e5183fe9726273a415 100644 (file)
@@ -46,93 +46,7 @@ class backuplib_test extends UnitTestCase {
     var $firstcolumn;
     var $testfiles = array();
     var $userbasedir;
-    
-    /* The mocking of the $rs and $db objects is problematic. Somehow it's affecting other unit test suites. 
-       I'm commenting this off until this is resolved -- nicolasconnault@gmail.com --
 
-    function setUp() {
-        global $db, $CFG;
-        $this->real_db = fullclone($db);
-        $db = new MockADODB_mysql();
-        $this->rs = new MockADORecordSet_mysql();
-        $this->rs->EOF = false;
-        $this->firstcolumn = new stdClass();
-        $this->firstcolumn->name = 'id';
-        
-        // Override dataroot: we don't want to test with live data
-        $this->real_dataroot = fullclone($CFG->dataroot);
-        $CFG->dataroot .= '/unittests';
-        $this->userbasedir = $CFG->dataroot.'/user';
-
-        // Create some sample files in this temporary directory
-        mkdir($CFG->dataroot);
-        mkdir($this->userbasedir);
-        
-        $this->testfiles = array('0/1','0/3','1000/1043','457498000/457498167');
-        foreach ($this->testfiles as $file) {
-            $parts = explode('/', $file);
-
-            if (!file_exists("$this->userbasedir/{$parts[0]}")) {
-                mkdir("$this->userbasedir/{$parts[0]}");
-            }
-            mkdir("$this->userbasedir/$file");
-            $handle = fopen("$this->userbasedir/$file/f1.gif", 'w+b');
-            fclose($handle);
-        } 
-    }
-
-    function tearDown() {
-        global $CFG, $db;
-        
-        if (!is_null($this->real_dataroot) && $this->real_dataroot != $CFG->dataroot) {
-            remove_dir($CFG->dataroot);
-        }
-        $db = $this->real_db;
-        $CFG->dataroot = $this->real_dataroot;
-    }
-
-    function test_backup_copy_user_files() {
-        global $CFG, $db;
-        $preferences = new stdClass();
-        $preferences->backup_unique_code = time();
-        
-        $db->setReturnValue('Execute', $this->rs);
-        $this->rs->setReturnValue('RecordCount', 1);
-        $this->rs->fields = array(1);
-
-        // Perform the backup
-        backup_copy_user_files($preferences);
-        
-        // Check for the existence of the backup file
-        $backupfile = "$CFG->dataroot/temp/backup/$preferences->backup_unique_code/user_files";
-        $this->assertTrue(file_exists($backupfile));
-
-        // Check for the existence of the user files in the backup file
-        foreach ($this->testfiles as $file) {
-            $parts = explode('/', $file);
-            $section = $parts[0];
-            $userid = $parts[1]; 
-            $userimage = "$CFG->dataroot/temp/backup/$preferences->backup_unique_code/user_files/$section/$userid/f1.gif";
-            $this->assertTrue(file_exists($userimage));
-        }
-    }
-
-    // This is a moodlelib method but it is used in backuplib, so it is tested here in that context, with typical backup data.
-    function test_get_user_directories() {
-        global $CFG;
-        $dirlist = get_user_directories(); 
-        $this->assertEqual(4, count($dirlist));
-
-        foreach ($this->testfiles as $file) {
-            $parts = explode('/', $file);
-            $section = $parts[0];
-            $userid = $parts[1];
-
-            $this->assertEqual($file, $dirlist[$userid]['userfolder']);
-            $this->assertEqual($this->userbasedir, $dirlist[$userid]['basedir']);
-        }
-    } 
-    */
 }
 
 ?>