Using custom test helpers in your test cases I'm trying to write test cases for my custom module and in order to speed things along for current and future testing I defined a garbage class that can spit out random data. However the testing module cannot seem to locate my Garbage class. After some debugging I realize that Drupal looks in the registry table to find the class and while my class is defined in the default registry table, simpletest creates it's own custom registry table to run tests which doesn't contain my class or it's location. Is there any way around this or some way to force simpletest to make an exact duplicate of the registry table?

Notes:


The garbage class is located in a separate file (Garbage.php)
Yes I do have 'files[] = Garbage.php' in my .info file.
While I could just move the garbage functions into test case itself, I may need to reuse it for other tests later on so having it in a separate class is ideal.


Garbage class

    class Garbage {
        public static function getGarbageString(int $i = 1) {
            $return = array();
            for ($j = 0; $j &lt; $i; $j++) {
                $return[$j] = self::_getRandomString();
            }

            return $i == 1 ? $return[0] : $return;
        }

        private static function _getRandomChar() {
            return chr(mt_rand(33,126));
        }

        private static function _getRandomString() {
            $length = mt_rand(1, 255);
            $return = '';
            for ($i = 0; $i &lt; $length; $i++) {
                $return .= self::_getRandomChar();
            }

            return $return;
        }
    }


Located in .module file

    function getRecord($recordName) {
        return $records[$recordName];
    }


Located in RecordTestCases which extends DrupalWebTestCase

    public function testGetRecord() {
        $badData = Garbage::getGarbageString();
        $this-&gt;assertNull(getRecord($badData), 'Testing get record with bad data');
    }
If getRecord() and testGetRecord() are methods of the Garbage class, then you have a misplaced } bracket.

Alternately, testGetRecord() will have no idea what to do with $this, since it's not part of a class definition. It would need to be a method of a subclass of DrupalUnitTest, or DrupalWebTest. As-is, PHP will choke on it.