/**
  *
  */
 public function __construct()
 {
     $this->db = StaticDatabaseConnection::getInstance();
     $this->knownItems = $this->getNewCollection();
     $this->entityMapper = EntityMapper::getInstance();
     $this->tablename = Nomenclature::repositoryClassnameToTablename(get_called_class());
 }
Exemplo n.º 2
0
 /**
  * @throws DatabaseMigratorException
  */
 public function __construct()
 {
     $this->db = StaticDatabaseConnection::getInstance();
     $this->migrationDirectory = Configuration::get('phpframework', 'db.migrator.directory');
     if (!$this->migrationDirectory) {
         throw new DatabaseMigratorException('Migration directory was not configured.', 1415085595);
     }
     if (!is_dir($this->migrationDirectory)) {
         throw new DatabaseMigratorException('Migration directory "' . $this->migrationDirectory . '" does not exist or is not a directory.', 1415085126);
     }
     $this->lastExecutedVersion = $this->getLastExecutedVersion();
 }
 public function setUp()
 {
     Configuration::reset();
     $database = 'phpunit_tests';
     $host = '127.0.0.1';
     $password = '';
     $user = '******';
     Configuration::set('phpframework', 'db.mysql.database', $database);
     Configuration::set('phpframework', 'db.mysql.host', $host);
     Configuration::set('phpframework', 'db.mysql.password', $password);
     Configuration::set('phpframework', 'db.mysql.user', $user);
     $this->pdo = new \PDO('mysql:host=' . $host . ';dbname=' . $database . ';port=3306', $user, $password);
     StaticDatabaseConnection::reset();
     $this->fixture = StaticDatabaseConnection::getInstance();
 }
Exemplo n.º 4
0
 public function setUp()
 {
     Configuration::reset();
     $database = 'phpunit_tests';
     $host = '127.0.0.1';
     $password = '';
     $user = '******';
     Configuration::set('phpframework', 'db.mysql.database', $database);
     Configuration::set('phpframework', 'db.mysql.host', $host);
     Configuration::set('phpframework', 'db.mysql.password', $password);
     Configuration::set('phpframework', 'db.mysql.user', $user);
     $this->basePath = dirname(__FILE__);
     $this->db = StaticDatabaseConnection::getInstance();
     $this->db->query('DROP TABLE IF EXISTS `migration_ver`');
     $this->db->query('DROP TABLE IF EXISTS `migrator_test_1`');
     $this->db->query('DROP TABLE IF EXISTS `migrator_test_2`');
     $this->db->query('DROP TABLE IF EXISTS `migrator_test_error`');
     $this->db->query('DROP TABLE IF EXISTS `migrator_test_timestamps`');
 }