Hey, i got the same problem too. I am still not able to import my
fixtures.
My cakephp version is: 1.2.0.6311 beta, and my simpletest version is :
1.0.1beta2
This is my model:
<?php
class Stock extends AppModel {
var $name = 'Stock';
var $useTable = 'stocks';
var $primaryKey = 'SYMBOL';
var $validate = array(
);
?>
<?php
App::import('Model', 'Stock');
class StockTest extends Stock{
var $name = 'StockTest';
var $useDbConfig = 'test_suite';
var $cacheSources = false;
// var $useTable = null;
// var $tablePrefix = null;
}
class StockTestCase extends CakeTestCase {
var $fixtures = array('stock_test');
function testCreateRecords() {
$this->TestObject = new StockTest();
$result = $this->TestObject->findCount();
$expected = count($this->records);
$this->assertEqual($result, $expected);
}
}
?>
My fixture:
<?php
class StockTestFixture extends CakeTestFixture {
var $name = 'StockTest';
var $import = 'Stock';
var $records = array(
.......
);
}
?>
The error that i got is:
Error: Database table test_suite_stocks for model Stock was not
found.
I just don't get it. I can make my unit testing working without the
fixture. But, it will go to my real table instead of the test suit
table. Please help. I have been trying to do this for couple days
now.
On Jan 8, 4:35 pm, Robby Anderson <[EMAIL PROTECTED]> wrote:
> Woo hoo! Got it to work. For anyone interested, I believe it had to do
> with the customtablein my Model declaration (var $useTable).
>
> To solve my issue, I added two lines to my Test Model declaration:
>
> class UserTest extends User {
>
> var $name = 'UserTest';
> var $useDbConfig = 'test_suite';
> var $cacheSources = false;
>
> var $useTable = null;
> var $tablePrefix = null;
>
> }
>
> The last two lines - setting useTable and tablePrefix to null - solved
> my issue, and now my test structure/data is importing perfectly! Me
> = :)
>
> On Jan 8, 3:55 pm, Gwoo <[EMAIL PROTECTED]> wrote:
>
> > Robby,
> > Come to IRC, its much more fun than having to send 4 messages in 2hrs
> > with no response.
> > #cakephp, irc.freenode.net
>
> Th anks, Gwoo - I'll do that.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---