3460 Posts in 1064 Topics by 739 members
|Go to End|
22 December 2010 at 11:50pm Last edited: 23 December 2010 1:11am
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')
and the relevant part of the fixture file:
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');
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:
[Notice] Undefined index: productsearchservice
The same goes with $_ALL_CLASSES
now how can I influence the test manifest?
23 December 2010 at 1:57pm
all you need to do is dev/build?flush=all. to be on the safe side you could empty your cache folder manually. how does your test look like? does that error give you a backtrace?
23 December 2010 at 11:45pm
Thank you very much Andy, emptying the cache folder did the trick! Sometimes the solution is just too easy...
Cheers and Merry Christmas
|Go to Top|