protected function setUp()
 {
     date_default_timezone_set("Europe/Paris");
     //Prepulate database and load with test users
     DinklyDataConfig::setActiveConnection('unit_test');
     DinklyBuilder::buildTable('unit_test', 'TestUser', null, false);
     DinklyBuilder::loadAllFixtures('unit_test', false);
 }
 protected function setUp()
 {
     date_default_timezone_set("Europe/Paris");
     $this->db_creds = array('host' => 'localhost', 'user' => 'root', 'pass' => 'root', 'name' => 'dinkly_unit_test');
     //Prepulate database and load with test users
     DinklyDataConfig::setActiveConnection('unit_test');
     DinklyBuilder::buildTable('unit_test', 'TestUser', null, false);
     DinklyBuilder::loadAllFixtures('unit_test', false);
 }
 public function setUp()
 {
     date_default_timezone_set("Europe/Paris");
     $this->dsn = 'mysql:dbname=dinkly_unit_test;host=localhost;port=3306';
     $this->username = '******';
     $this->password = '******';
     //Prepulate database and load with test users
     DinklyDataConfig::setActiveConnection('unit_test');
     DinklyBuilder::buildTable('unit_test', 'TestUser', null, false);
     DinklyBuilder::loadAllFixtures('unit_test', false);
 }
 public function testDropTable()
 {
     //Build the table and database as needed, load test user
     DinklyBuilder::buildTable('unit_test', 'TestUser', null, false);
     DinklyBuilder::loadAllFixtures('unit_test', false);
     //Test that we have a hyrdrated user model to work with
     $user = new TestUser();
     $this->assertTrue($user->init(1));
     //Test the successful removal of the table
     $this->assertTrue(DinklyBuilder::dropTable('unit_test', 'TestUser'));
 }
 protected function setUp()
 {
     date_default_timezone_set("Europe/Paris");
     $this->dsn = 'mysql:dbname=dinkly_unit_test;host=localhost;port=3306';
     $this->username = '******';
     $this->password = '******';
     //Prepulate database and load with test users
     DinklyDataConfig::setActiveConnection('unit_test');
     DinklyBuilder::buildTable('unit_test', 'TestUser', null, false);
     DinklyBuilder::loadAllFixtures('unit_test', false);
     $this->user = new TestUser();
     $this->user->init(1);
     $this->valid_array = array('id' => $this->user->getId(), 'created_at' => $this->user->getCreatedAt(), 'updated_at' => $this->user->getUpdatedAt(), 'username' => $this->user->getUserName(), 'password' => $this->user->getPassword(), 'first_name' => $this->user->getFirstName(), 'last_name' => $this->user->getLastName(), 'title' => $this->user->getTitle(), 'last_login_at' => $this->user->getLastLoginAt(), 'login_count' => $this->user->getLoginCount());
 }
Example #6
0
    echo "       -s     Schema name, in underscore format (required)\n";
    echo "       -m     Model name, in camel-case format (optional)\n";
    echo "       -p     Plugin name, in underscore format (optional)\n";
    echo "       -e     Environment, corresponding to a database connection entry in config.yml (defaults to 'dev')\n";
    echo "       -t     Truncate table before loading fixture (optional)\n";
    echo "\n";
    echo "   Example: php tools/load_fixtures.php -s=monkey_tail -m=Banana -t\n";
    echo "\n =======================================================================================\n\n";
    exit;
}
if (!isset($options['s'])) {
    echo "\nPlease use the -s flag to indicate which fixture set to use.\nExample: php tools/load_fixtures.php -s=dinkly\n\n";
    echo "You may optionally use the -m flag to indicate a single fixture to load.\nExample: php php tools/load_fixtures.php -s=dinkly -m=fubar\n\n";
    die;
}
$truncate = false;
if (isset($options['t'])) {
    $truncate = true;
}
$plugin_name = false;
if (isset($options['p'])) {
    $plugin_name = $options['p'];
}
if (isset($options['m'])) {
    if (isset($options['e'])) {
        $Dinkly = new Dinkly($options['e']);
    }
    DinklyBuilder::loadFixture($options['s'], $options['m'], $plugin_name, $truncate);
} else {
    DinklyBuilder::loadAllFixtures($options['s'], $plugin_name, $truncate);
}