Hi Bakers,
I'm trying to import an existing table. I found a few posts relating
to this, but none with the same problem.
Basically, I want the test script to create a table, run the tests
against it and its fixtures, then destroy the table.
I've managed to get this behaviour when I wasn't importing an existing
model, but now I'm stuck.
Ideally this should be in the normal DB with a "test_suite" table
prefix (as is the behaviour when not importing from an existing
model), although in another DB is okay, as long as it runs the CREATE
TABLE and DROP TABLE statements for me.
What I have:
//user_confirmation_test_fixture.php
<?php
class UserConfirmationTestFixture extends CakeTestFixture {
var $name = 'UserConfirmationTest';
var $import = 'User';
}
?>
//the actual test case
<?php
App::import('Model', 'User');
class UserTest extends User
{
var $useDbConfig = 'test_suite';
//tried a few variations here!
//var $name = 'UserTest';
//var $useTable='users';
//var $useDbConfig = 'default';
//var $tablePrefix = '';
}
class UserTestCase extends CakeTestCase
{
var $TestUser = null;
var $fixtures = array( 'user_confirmation_test' );
function setUp() {
$this->TestUser = new UserTest();
}
function tearDown() {
unset($this->TestUser);
}
function testConfirmEmail()
{
// some stuff
}
}
?>
My usual error is:
Query: DESCRIBE `test_suite_`
Query: DESCRIBE `test_suite_`
Error: Database table test_suite_users for model User was not found.
But I want the table creation taken care of by the test suite!!
Any ideas? Maybe it's just a typo or naming convention or some such...
any help appreciated!
Wood
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---