views:

540

answers:

2

I'm using cakePHP and am using Simpletest as the testing suite. Whenever I run tests on the models, I get an error:

Missing Database Table
Error: Database table account_types for model AccountType was not found."

(For whatever)

Does anyone know how to fix this problem?

My guess is the fixtures are not being created or something along these lines.

+2  A: 

Found the answer to my particular problem. In the actual test case files (mine was in app->tests->cases->models) the fixtures used were not auto-generated into the $fixtures variable.

The simple solution to this was whenever a "Missing Database Table" error comes up, I would make sure I put the name of the database not found (the actual fixture) in the $fixture variable in the test file.

So lets say that account_types was not found. In the actual test case I was running, where the $fixtures variable was, I would do:

var $fixtures = array('whatever_fixtures_where_already_here', 'name_of_missing_fixture', 'name_of_another_missing_fixture');
A: 

All fixtures that you will be using directly must be in the fixtures array and there also have to be fixtures created for every model related to (hasMany, belongsTo, etc) the fixtures in the fixture array

jarroddungan