I'm writing my first local plugin and things are going well except for my latest unit test which is trying to test DB access to the plugin's table. I suspect that this is a test environment setup issue, but I really have no idea what to do about it. When I run my tests, I currently get the following error:
coding_exception: Coding error detected, it must be fixed by a programmer: moodle_database::insert_record_raw() no fields found.
/Applications/MAMP/htdocs/moodle25/lib/dml/mysqli_native_moodle_database.php:1075
/Applications/MAMP/htdocs/moodle25/lib/dml/mysqli_native_moodle_database.php:1132
...
The test dataroot and table prefix are configured as:
$CFG->phpunit_dataroot = '~/moodle/phpunit_data/moodle25';
$CFG->phpunit_prefix = 'phpu_';
Printing out objects in various places shows me that the plugin's table does not appear to exist in the database. Is there something I need to do to create the test database instance or is that created/destroyed on each test run? The plugin's table does exist in the database so I know that the install.xml is at least correct. I've read and re-read all of the phpunit testing related pages and don't know what I'm missing.
Any help would be fantastic.
Thanks!
Michael