public function setUp()
 {
     $configuration = new ContentArchiveConfiguration();
     $configuration->setContentArchiveFolder(__DIR__ . '/../../resources/ContentArchiveExample1');
     $connection = $configuration->createReadOnlyConnection();
     $this->connection = $connection;
     KVMLoggerFactory::createWithKLogger(__DIR__ . '/../../../tmp');
 }
 public function setUp()
 {
     $target = __DIR__ . '/../../../tmp/TestContentArchive';
     $configuration = new ContentArchiveConfiguration();
     $configuration->setContentArchiveFolder($target);
     $connection = $configuration->createReadWriteConnection();
     $this->connection = $connection;
 }
 public function setUp()
 {
     $target = __DIR__ . '/../../../tmp/ExampleContentArchive';
     $configuration = new ContentArchiveConfiguration();
     $configuration->setContentArchiveFolder($target);
     $connection = $configuration->createReadWriteConnection();
     $this->connection = $connection;
     KVMLoggerFactory::createWithKLogger(__DIR__ . '/../../../tmp');
 }
 public function setUp()
 {
     $target = __DIR__ . '/../../../tmp/ExampleContentArchive';
     $configuration = new ContentArchiveConfiguration();
     $configuration->setContentArchiveFolder($target);
     $connection = $configuration->createReadWriteConnection();
     $this->connection = $connection;
     $this->repository = new Repository('phpunit', $this->connection);
 }
 public function createContentArchiveRepository($name, $folder, $options = ['files' => true], $cache = true)
 {
     $this->options = $options;
     $folder = rtrim($folder, '/');
     $configuration = new ContentArchiveConfiguration();
     $configuration->setContentArchiveFolder($folder);
     $connection = $configuration->createReadWriteConnection();
     $fileManager = null;
     if ($this->getOption('files', true) == true) {
         $fileManager = new DirectoryBasedFilesAccess($folder . '/files');
     }
     $repository = $this->createRepository($name, $connection, $fileManager, $this->getOption('title', null), $cache);
     return $repository;
 }
 protected function getNextId($contentTypeName, $dataDimensions)
 {
     $finder = new Finder();
     $path = $this->configuration->getContentArchiveFolder() . '/data/content/' . $contentTypeName;
     $path = realpath($path);
     if ($path) {
         $finder->in($path);
         $finder->files()->name('*.json');
         $next = 0;
         /** @var SplFileInfo $file */
         foreach ($finder as $file) {
             // Sorting by name won't help here
             $next = max($next, (int) $file->getBasename('.json'));
         }
         return ++$next;
     } else {
         return 1;
     }
 }