public function setUp()
 {
     if (defined('PHPUNIT_CREDENTIALS_MYSQL_SCHEMALESS_HOST')) {
         $configuration = new MySQLSchemalessConfiguration();
         $configuration->initDatabase(PHPUNIT_CREDENTIALS_MYSQL_SCHEMALESS_HOST, PHPUNIT_CREDENTIALS_MYSQL_SCHEMALESS_DBNAME, PHPUNIT_CREDENTIALS_MYSQL_SCHEMALESS_USERNAME, PHPUNIT_CREDENTIALS_MYSQL_SCHEMALESS_PASSWORD);
         $configuration->setCMDLFolder(__DIR__ . '/../../resources/ContentArchiveExample1/cmdl');
         $configuration->addContentTypes('phpunit');
         $connection = $configuration->createReadWriteConnection();
         $this->connection = $connection;
         $repository = new Repository('phpunit', $connection);
         KVMLoggerFactory::createWithKLogger(__DIR__ . '/../../../tmp');
     }
 }
 public function setUp()
 {
     if (defined('PHPUNIT_CREDENTIALS_MYSQL_SCHEMALESS_HOST')) {
         $target = __DIR__ . '/../../../tmp/MySqlSchemaLessCMDL';
         $configuration = new MySQLSchemalessConfiguration();
         $configuration->initDatabase(PHPUNIT_CREDENTIALS_MYSQL_SCHEMALESS_HOST, PHPUNIT_CREDENTIALS_MYSQL_SCHEMALESS_DBNAME, PHPUNIT_CREDENTIALS_MYSQL_SCHEMALESS_USERNAME, PHPUNIT_CREDENTIALS_MYSQL_SCHEMALESS_PASSWORD);
         $configuration->setRepositoryName('phpunit');
         $configuration->addContentTypes();
         $configuration->addConfigTypes();
         $connection = $configuration->createReadWriteConnection();
         $this->connection = $connection;
         $this->repository = new Repository('phpunit', $connection);
         KVMLoggerFactory::createWithKLogger(__DIR__ . '/../../../tmp');
     }
 }
Ejemplo n.º 3
0
 public function createMySQLSchemalessRepository($name, $options = [], $cache = true)
 {
     $this->options = $options;
     $configuration = new MySQLSchemalessConfiguration();
     $this->requireOption('database');
     $this->options = $options['database'];
     $this->requireOptions(['host', 'dbName', 'user', 'password']);
     $configuration->initDatabase($this->getOption('host'), $this->getOption('dbName'), $this->getOption('user'), $this->getOption('password'), $this->getOption('port', 3306));
     $this->options = $options;
     if ($this->hasOption('cmdlFolder')) {
         $configuration->setCMDLFolder($this->getOption('cmdlFolder'));
     }
     $configuration->addContentTypes($name);
     $connection = $configuration->createReadWriteConnection();
     $fileManager = null;
     if ($this->hasOption('filesFolder')) {
         $fileManager = new DirectoryBasedFilesAccess($this->getOption('filesFolder'));
     }
     $repository = $this->createRepository($name, $connection, $fileManager, $this->getOption('title', null), $cache);
     return $repository;
 }