I am trying to run a simple unit test in my model. The problem is that every time I run the test, my database table is discarded. I have public $ dropTables = false; Can anyone understand why the merchant_rejects table is still missing? As you will see, I have tried many different methods in my tool.
I think I will have to go through the code and find out when the table will be deleted.
Here is the code for my MovieStarFixture.php fixture:
class MovieStarFixture extends CakeTestFixture {
var $name = 'MovieStar';
var $fields = array(
'id' => array(
'type'=>'string',
'null' => false,
'default' => NULL,
'length' => 36,
'key' => 'primary'),
'movie_id' => array(
'type'=>'string',
'null' => false,
'default' => NULL,
'length' => 36),
'trace' => array('type'=>'string', 'null' => false, 'default' => NULL),
'star_date' => array(
'type'=>'datetime',
'null' => false,
'default' => NULL),
'movie_star_type_id' => array(
'type'=>'string',
'null' => false,
'default' => NULL,
'length' => 36),
'code' => array('type'=>'text', 'null' => false, 'default' => NULL),
'amount' => array('type'=>'float', 'null' => false, 'default' => 0),
'movie_star_recurrance_id' => array(
'type'=>'string',
'null' => false,
'default' => NULL,
'length' => 36),
'open' => array('type'=>'boolean', 'null' => false, 'default' => '1'),
'loss_axia' => array('type'=>'float', 'null' => true, 'default' => 0),
'loss_mgr1' => array('type'=>'float', 'null' => true, 'default' => 0),
'loss_mgr2' => array('type'=>'float', 'null' => true, 'default' => 0),
'loss_rep' => array('type'=>'float', 'null' => true, 'default' => 0)
);
var $records = array(
array(
'id' => '52ab9259-0070-4583-8d6f-4ac6c0a81cd7',
'movie_id' => '440b7d13-5618-4560-be1d-93c5a2900a5e',
'trace' => '3331313133423',
'star_date' => '2013-12-13',
'movie_star_type_id' => '64f7c386-6725-4c62-83ac-ae309bec8b10',
'code' => 'C01',
'amount' => '222.0000',
'movie_star_recurrance_id' => '',
'open' => true,
'loss_axia' => '23.0000',
'loss_mgr1' => '0',
'loss_mgr2' => '0',
'loss_rep' => '0'
));
This is my MovieStarTest.php:
<?php
App::uses('Controller', 'Controller');
App::uses('View', 'View');
App::uses('MovieStar', 'Model');
class MovieStarTest extends CakeTestCase {
public $fixtures = array(
'app.movie_star'
);
public $autoFixtures = false;
public $dropTables = false;
public function setUp() {
parent::setUp();
$this->MovieStar =& ClassRegistry::init('MovieStar');
$this->MovieStar->useDbConfig = 'test';
$this->loadFixtures('MovieStar');
}
public function testFixtures() {
$numberOfResults = $this->MovieStar->find('count');
debug($numberOfResults);
$resultGreaterThanMinimumValue = $numberOfResults > 2;
$this->assertTrue($resultGreaterThanMinimumValue);
}
public function testFixtures2() {
$numberOfResults = $this->MovieStar->find('count');
debug('$numberOfResults');
debug($numberOfResults);
$resultIsZero = $numberOfResults == 0;
$this->assertTrue($resultIsZero);
}
public function testFindStarsByMovieId() {
$movieId = '440b7d13-5618-4560-be1d-93c5a2900a5e';
$result = $this->MovieStar->findStarsByMovieId($movieId);
$expected = array(
array(
'MovieStar' => array(
'id' => '52ab9259-0070-4583-8d6f-4ac6c0a81cd7',
'movie_id' => '440b7d13-5618-4560-be1d-93c5a2900a5e',
'trace' => '3331313133423',
'star_date' => '2013-12-13',
'movie_star_type_id' => '64f7c386-6725-4c62-83ac-ae309bec8b10',
'code' => 'C01',
'amount' => '222.0000',
'movie_star_recurrance_id' => '',
'open' => true,
'loss_axia' => '23.0000',
'loss_mgr1' => null,
'loss_mgr2' => null,
'loss_rep' => null
)
)
);
debug("Expected");
debug($expected);
debug("Result");
debug($result);
$this->assertEquals($expected, $result);
}
public function tearDown() {
parent::tearDown();
}
}
I should be able to not drop tables by adding
public $dropTables = false;
But I don't see dropTables being checked before this method in lib / Cake / TestSuite / Fixture / CakeFixtureManager.php

In fact, this would clip the entire db. Where did my table fall?