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);
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
 public function testForMySQLKeywords()
 {
     //Let's make sure to start without a table
     DinklyBuilder::dropTable('unit_test', 'TestUser');
     //Grab a model and turn it into an array to be manipulated in tests that follow
     $model_yaml = DinklyBuilder::parseModelYaml('unit_test', 'TestUser', false);
     //Create a table with a column named after a MySQL keyword
     $model_yaml['registry'][] = array('key' => array('type' => 'int', 'allow_null' => true));
     $this->assertTrue(DinklyBuilder::buildTable('unit_test', 'TestUser', $model_yaml, 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);
 }
Ejemplo n.º 5
0
 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());
 }
Ejemplo n.º 6
0
    echo "       -h     Show this help\n";
    echo "       -m     Model name, in camel-case format (required)\n";
    echo "       -s     Schema name, in underscore format (required)\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 "       -i     Insert SQL (optional)\n";
    echo "\n";
    echo "   Example: php tools/gen_model.php -s=monkey_tail -m=FunkyNugget -i\n";
    echo "\n =======================================================================\n\n";
    exit;
}
if (!isset($options['s'])) {
    echo "\nPlease use the -s flag to indicate which schema set to use.\n\n";
    die;
}
if (!isset($options['m'])) {
    echo "\nPlease use the -m flag to indicate the desired model name to use.\n\n";
    die;
}
$plugin_name = null;
if (isset($options['p'])) {
    $plugin_name = $options['p'];
}
if (isset($options['e'])) {
    $Dinkly = new Dinkly($options['e'], true);
}
if (DinklyBuilder::buildModel($options['s'], $options['m'], $plugin_name)) {
    if (isset($options['i'])) {
        DinklyBuilder::buildTable($options['s'], $options['m'], $plugin_name);
    }
}