Hello,
I have a problem with testing and fixtures. The message says:
Couldn't run query:
INSERT INTO "ProductSearchServiceConfigurationItem" ("Name", "Value") VALUES ('user', 'foo123')
Table 'tmpdb1796961.ProductSearchServiceConfigurationItem' doesn't exist
ProductSearchServiceConfigurationItem is a custom DataObject introduced in the module I want to test. I ran /dev/build and in the production database the table exists but obviously SaphireTest does not create the corresponding table in the tmp database.
Is there anything I missed to set up?
If it helps, here is the code of the class:
class ProductSearchServiceConfigurationItem extends DataObject
{
static $db = array('Name' => 'Varchar',
'Value' => 'Varchar'
);
static $has_one = array('SearchService' => 'ProductSearchService');
public function getCMSFields()
{
$fields = new FieldSet(new TextField('Name', 'Name'),
new TextField('Value', 'Value')
);
return $fields;
}
}
and the relevant part of the fixture file:
ProductSearchServiceConfigurationItem:
conf_1:
Name: user
Value: foo123
Edit: It is getting stranger the more i try...
?debugmanifest=1 appended to the test case URL shows that the classes are correctly defined in the manifest
'productsearchservice' => '/var/www/[...]/code/ProductSearchService.php',
'productsearchserviceconfigurationitem' => '/var/www/[...]/code/ProductSearchServiceConfigurationItem.php',
but if I try to autoload them with this code at the beginning of the test case file:
class_exists('ProductSearchService') or die('class ProductSearchService not found');
class_exists('ProductSearchServiceConfigurationItem') or die('class ProductSearchServiceConfigurationItem not found');
it fails:
class ProductSearchService not found
Edit 2: okay, debugmanifest does not show the manifest actually used by the tests... I added these lines to the test case file:
global $_CLASS_MANIFEST;
echo '<pre>';
var_dump($_CLASS_MANIFEST['productsearchservice']);
var_dump($_CLASS_MANIFEST['productsearchserviceconfigurationitem']);
and got
[Notice] Undefined index: productsearchservice
The same goes with $_ALL_CLASSES
now how can I influence the test manifest?