public function testGetRecords()
 {
     $repository = new Repository('phpunit', $this->connection);
     $repository->selectContentType('temp');
     $records = $repository->getRecords();
     $this->assertCount(608, $records);
 }
예제 #2
0
 public function testConfigTypes()
 {
     $repository = new Repository('phpunit', $this->connection);
     $configTypeNames = $repository->getConfigTypeNames();
     $this->assertCount(3, $configTypeNames);
     $this->assertTrue($repository->hasConfigType('config1'));
 }
 public function testSliceFilteredRecords()
 {
     $this->repository->selectContentType('example01');
     $records = $this->repository->getRecords('source > 3', 'source', 1, 5);
     $this->assertCount(5, $records);
     $this->assertEquals([4, 5, 6, 7, 8], array_keys($records));
     $records = $this->repository->getRecords('source > 3', 'source', 2, 5);
     $this->assertCount(2, $records);
     $this->assertEquals([9, 10], array_keys($records));
 }
 public function testGetConfigNewConnection()
 {
     $repository = new Repository('phpunit', $this->connection);
     $config = $repository->getConfig('config1');
     $this->assertInstanceOf('AnyContent\\Client\\Config', $config);
     $this->assertEquals('Hamburg', $config->getProperty('city'));
     $repository->registerRecordClassForConfigType('config1', 'AnyContent\\Client\\AlternateConfigRecordClass');
     $config = $repository->getConfig('config1');
     $this->assertInstanceOf('AnyContent\\Client\\AlternateConfigRecordClass', $config);
     $config->setProperty('city', 'Hamburg');
 }
예제 #5
0
 public function addRepository(Repository $repository)
 {
     if ($repository->getName() == '') {
         throw new AnyContentClientException('Cannot add repository without name');
     }
     $this->repositories[$repository->getName()] = $repository;
     if ($repository instanceof CachingRepository) {
         $repository->setCacheProvider($this->getCacheProvider());
     }
     return $repository;
 }
 protected function createRepository($name, $connection, $fileManager, $title, $cache)
 {
     if ($cache == true) {
         $repository = new CachingRepository($name, $connection, $fileManager);
         $repository->enableSingleContentRecordCaching(60);
         $repository->enableAllContentRecordsCaching(60);
         $repository->enableContentQueryRecordsCaching(60);
     } else {
         $repository = new Repository($name, $connection, $fileManager);
     }
     $repository->setTitle($title);
     return $repository;
 }
 public function testNewConnection()
 {
     $this->repository->selectContentType('example01');
     $record = $this->repository->getRecord(1);
     $this->assertEquals(5, $record->getRevision());
     $this->assertEquals('example01', $record->getContentTypeName());
     $this->assertEquals(1, $record->getID());
     $this->assertEquals('New Record 1 - Revision 5', $record->getName());
     $this->assertEquals('Test 1', $record->getProperty('article'));
     $records = $this->repository->getRecords();
     $this->assertCount(5, $records);
     $this->assertEquals(5, $this->repository->countRecords());
 }
 /**
  * @param $configTypeName
  *
  * @return \CMDL\ConfigTypeDefinition|ContentTypeDefinition|\CMDL\DataTypeDefinition|null
  * @throws AnyContentClientException
  * @throws \CMDL\CMDLParserException
  */
 public function getConfigTypeDefinition($configTypeName)
 {
     if ($this->getConfiguration()->hasConfigType($configTypeName)) {
         $cacheKey = '[cmdl][config][' . $configTypeName . ']';
         if ($this->repository) {
             $cacheKey = '[' . $this->repository->getName() . ']' . $cacheKey;
         }
         if ($this->cmdlCachingCheckLastModifiedDate) {
             $cacheKey .= '[' . $this->getCMDLLastModifiedDate(null, $configTypeName) . ']';
         }
         if ($this->getCMDLCache()->contains($cacheKey)) {
             return unserialize($this->getCMDLCache()->fetch($cacheKey));
         }
         $cmdl = $this->getCMDLForConfigType($configTypeName);
         if ($cmdl) {
             $parser = $this->getParser();
             $definition = $parser->parseCMDLString($cmdl, $configTypeName, null, 'config');
             if ($definition) {
                 $this->getCMDLCache()->save($cacheKey, serialize($definition), (int) $this->cmdlCaching);
                 return $definition;
             }
         }
     }
     throw new AnyContentClientException('Unknown config type ' . $configTypeName);
 }
 public function testSortByUserInfo()
 {
     $this->repository->selectContentType('example01');
     $userInfo1 = new UserInfo('a', 'a', 'a', 1);
     $userInfo2 = new UserInfo('b', 'b', 'b', 2);
     $record1 = $this->repository->createRecord('New Record')->setId(1);
     $record2 = $this->repository->createRecord('New Record')->setId(2);
     $records = [1 => $record1, 2 => $record2];
     $record1->setCreationUserInfo($userInfo1);
     $record2->setCreationUserInfo($userInfo2);
     $records = RecordsSorter::orderRecords($records, ['.info.creation.username']);
     $this->assertEquals([1, 2], array_keys($records));
     $records = RecordsSorter::orderRecords($records, ['.info.creation.firstname']);
     $this->assertEquals([1, 2], array_keys($records));
     $records = RecordsSorter::orderRecords($records, ['.info.creation.lastname']);
     $this->assertEquals([1, 2], array_keys($records));
     $records = RecordsSorter::orderRecords($records, ['.info.creation.timestamp']);
     $this->assertEquals([1, 2], array_keys($records));
     $records = RecordsSorter::orderRecords($records, ['.info.creation.username-']);
     $this->assertEquals([2, 1], array_keys($records));
     $records = RecordsSorter::orderRecords($records, ['.info.creation.firstname-']);
     $this->assertEquals([2, 1], array_keys($records));
     $records = RecordsSorter::orderRecords($records, ['.info.creation.lastname-']);
     $this->assertEquals([2, 1], array_keys($records));
     $records = RecordsSorter::orderRecords($records, ['.info.creation.timestamp-']);
     $this->assertEquals([2, 1], array_keys($records));
     $record1->setLastChangeUserInfo($userInfo1);
     $record2->setLastChangeUserInfo($userInfo2);
     $records = RecordsSorter::orderRecords($records, ['.info.lastchange.username']);
     $this->assertEquals([1, 2], array_keys($records));
     $records = RecordsSorter::orderRecords($records, ['.info.lastchange.firstname']);
     $this->assertEquals([1, 2], array_keys($records));
     $records = RecordsSorter::orderRecords($records, ['.info.lastchange.lastname']);
     $this->assertEquals([1, 2], array_keys($records));
     $records = RecordsSorter::orderRecords($records, ['.info.lastchange.timestamp']);
     $this->assertEquals([1, 2], array_keys($records));
     $records = RecordsSorter::orderRecords($records, ['.info.lastchange.username-']);
     $this->assertEquals([2, 1], array_keys($records));
     $records = RecordsSorter::orderRecords($records, ['.info.lastchange.firstname-']);
     $this->assertEquals([2, 1], array_keys($records));
     $records = RecordsSorter::orderRecords($records, ['.info.lastchange.lastname-']);
     $this->assertEquals([2, 1], array_keys($records));
     $records = RecordsSorter::orderRecords($records, ['.info.lastchange.timestamp-']);
     $this->assertEquals([2, 1], array_keys($records));
 }
 /**
  * Test showing the flaws of the full flash cache strategy
  *
  * @throws \AnyContent\AnyContentClientException
  */
 public function testCacheStrategyFailure()
 {
     $repository = $this->repository;
     $repository->enableSingleContentRecordCaching(60);
     $repository->enableAllContentRecordsCaching(60);
     $repository->selectContentType('profiles');
     $record = $repository->getRecord(1);
     $this->assertEquals('UDG', $record->getName());
     $nonCachingRepository = new Repository('phpunit', $this->connection);
     $nonCachingRepository->selectContentType('profiles');
     $record = $nonCachingRepository->getRecord(1);
     $this->assertEquals('UDG', $record->getName());
     $record->setName('');
     $nonCachingRepository->saveRecord($record);
     $record = $nonCachingRepository->getRecord(1);
     $this->assertEquals('', $record->getName());
     $record = $repository->getRecord(1);
     $this->assertEquals('UDG', $record->getName());
 }
 public function exportXLSX(Repository $repository, $contentTypeName, $workspace = 'default', $language = 'default', $viewName = 'exchange')
 {
     $repository->selectContentType($contentTypeName);
     // Select view and fallback if necessary
     $contentTypeDefinition = $repository->getContentTypeDefinition();
     $viewDefinition = $contentTypeDefinition->getExchangeViewDefinition($viewName);
     $viewName = $viewDefinition->getName();
     $this->writeln('Connecting repository');
     $this->writeln('');
     $repository->selectWorkspace($workspace);
     $repository->selectLanguage($language);
     $repository->selectView($viewName);
     /** @var Record[] $records */
     $records = $repository->getRecords('', '.id', 1);
     if ($records !== false) {
         // Create new PHPExcel object
         $objPHPExcel = new \PHPExcel();
         // use temp folder for processing of large files
         $cacheMethod = \PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp;
         $cacheSettings = array('memoryCacheSize' => '12MB');
         \PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
         // Set document properties
         $objPHPExcel->getProperties()->setCreator("AnyContent CMCK")->setLastModifiedBy("AnyContent CMCK")->setTitle("Full Export from content type " . $contentTypeDefinition->getTitle())->setSubject("AnyContent Export")->setDescription("");
         $worksheet = $objPHPExcel->setActiveSheetIndex(0);
         $worksheet->setTitle('Export');
         $worksheet->setCellValueByColumnAndRow(0, 1, '.id');
         $worksheet->getStyleByColumnAndRow(0, 1)->getFont()->setBold(false)->setItalic(true);
         $worksheet->setCellValueByColumnAndRow(1, 1, '.revision');
         $worksheet->getStyleByColumnAndRow(1, 1)->getFont()->setBold(false)->setItalic(true);
         $row = 1;
         $column = 2;
         foreach ($contentTypeDefinition->getProperties($viewName) as $property) {
             $worksheet->setCellValueByColumnAndRow($column, $row, $property);
             $worksheet->getStyleByColumnAndRow($column, $row)->getFont()->setBold(true);
             $worksheet->getColumnDimensionByColumn($column)->setWidth(20);
             $column++;
         }
         $row++;
         foreach ($records as $record) {
             $this->writeln('Processing record ' . $record->getID() . ' - ' . $record->getName());
             $worksheet->setCellValueByColumnAndRow(0, $row, $record->getID());
             $worksheet->setCellValueByColumnAndRow(1, $row, $record->getRevision());
             $column = 2;
             foreach ($contentTypeDefinition->getProperties($viewName) as $property) {
                 $worksheet->setCellValueByColumnAndRow($column, $row, $record->getProperty($property));
                 $column++;
             }
             $row++;
         }
         $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
         ob_start();
         $objWriter->save('php://output');
         $excelOutput = ob_get_clean();
         return $excelOutput;
     }
     return false;
 }
 public function testReverseSortRecords()
 {
     $this->repository->selectContentType('example01');
     // 1
     // 2
     //  -- 4
     //     -- 8
     //     -- 5
     //  -- 6
     // 3
     //  -- 9
     // 7
     $this->repository->sortRecords([1 => 0, 2 => 0, 4 => 2, 8 => 4, 5 => 4, 6 => 2, 3 => 0, 9 => 3, 7 => 0]);
     $records = $this->repository->getRecords();
     $this->assertEquals(2, $records[6]->getParent());
     $records = $this->repository->getSortedRecords(4);
     $this->assertEquals([8, 5], array_keys($records));
     $records = $this->repository->getSortedRecords(4, true);
     $this->assertEquals([4, 8, 5], array_keys($records));
     $records = $this->repository->getSortedRecords(4, true, 0, 1);
     $this->assertEquals([2, 4], array_keys($records));
     $records = $this->repository->getSortedRecords(4, false, 0, 1);
     $this->assertEquals([2], array_keys($records));
     $records = $this->repository->getSortedRecords(5, true, 0, 1);
     $this->assertEquals([2, 4, 5], array_keys($records));
     $records = $this->repository->getSortedRecords(9, true, 0, 1);
     $this->assertEquals([3, 9], array_keys($records));
     $records = $this->repository->getSortedRecords(4, true, 1, 1);
     $this->assertEquals([2, 4, 8, 5], array_keys($records));
     $records = $this->repository->getSortedRecords(2, false, 1);
     $this->assertEquals([4, 6], array_keys($records));
     $records = MenuBuilder::getBreadcrumb($this->repository, 'example01', 8);
     $this->assertEquals([2, 4, 8], array_keys($records));
     $records = MenuBuilder::getExpandedMenu($this->repository, 'example01', 8);
     $this->assertEquals([1, 2, 4, 8, 5, 6, 3, 7], array_keys($records));
     $records = MenuBuilder::getExpandedMenu($this->repository, 'example01', 6);
     $this->assertEquals([1, 2, 4, 6, 3, 7], array_keys($records));
     $records = MenuBuilder::getExpandedMenu($this->repository, 'example01', 4);
     $this->assertEquals([1, 2, 4, 8, 5, 6, 3, 7], array_keys($records));
 }
 protected function getBinary(File $file)
 {
     if ($this->cacheBinaries == true) {
         if (array_key_exists($file->getId(), $this->cachedBinaries)) {
             return $this->cachedBinaries[$file->getId()];
         }
         $binary = $this->repository->getBinary($file);
         $this->cachedBinaries[$file->getId()] = $binary;
     } else {
         $binary = $this->repository->getBinary($file);
     }
     return $binary;
 }
예제 #14
0
 public function testNumericalComparison()
 {
     $this->repository->selectContentType('example01');
     $record1 = $this->repository->createRecord('New Record');
     $record1->setProperty('source', '110');
     $record2 = $this->repository->createRecord('Another Record');
     $record2->setProperty('source', '10');
     $record3 = $this->repository->createRecord('Another Record');
     $record3->setProperty('source', '12');
     $filter = new PropertyFilter('source < 111');
     $this->assertTrue($filter->match($record1));
     $this->assertTrue($filter->match($record2));
     $this->assertTrue($filter->match($record3));
 }
 public function testSaveRecords()
 {
     $this->repository->selectContentType('example01');
     for ($i = 1; $i <= 5; $i++) {
         $record = $this->repository->createRecord('New Record ' . $i);
         $this->assertEquals('DEFAULT', $record->getProperty('article', 'DEFAULT'));
         $record->setProperty('article', '');
         $id = $this->repository->saveRecord($record);
         $this->assertEquals($i, $id);
     }
     $record = $this->repository->getRecord(1);
     $this->assertEquals('DEFAULT', $record->getProperty('article', 'DEFAULT'));
     $record->setProperty('article', 0);
     $id = $this->repository->saveRecord($record);
     $record = $this->repository->getRecord(1);
     $this->assertEquals('0', $record->getProperty('article', 'DEFAULT'));
     $record->setProperty('article', null);
     $id = $this->repository->saveRecord($record);
     $record = $this->repository->getRecord(1);
     $this->assertEquals('DEFAULT', $record->getProperty('article', 'DEFAULT'));
 }
 public function testSetSequenceProperty()
 {
     $this->repository->selectContentType('profiles');
     $record = $this->repository->getRecord(5);
     $sequence = $record->getSequence('standorte');
     for ($i = 1; $i <= 5; $i++) {
         $item = new SequenceItem($record->getDataTypeDefinition(), 'standorte', 'standort');
         $item->setProperty('standort_name', 'Location ' . $i);
         $sequence->addItem($item);
         $this->assertEquals($i, count($sequence));
     }
     $record->setProperty('standorte', $sequence);
     $sequence = $record->getSequence('standorte');
     $i = 0;
     foreach ($sequence as $item) {
         $i++;
         $this->assertEquals('Location ' . $i, $item->getProperty('standort_name'));
         $this->assertEquals('standort', $item->getItemType());
         $this->assertInstanceOf('AnyContent\\Client\\SequenceItem', $item);
     }
     $this->assertEquals(5, $i);
 }
 public function testRecordCanAccessRepository()
 {
     $repository = new Repository('phpunit', $this->connection);
     $repository->selectContentType('example01');
     $definition = $repository->getContentTypeDefinition();
     $records = [];
     for ($i = 1; $i <= 5; $i++) {
         $record = new Record($definition, 'Test ' . $i);
         $records[] = $record;
     }
     $repository->saveRecords($records);
     $record = $repository->getRecord(1);
     $this->assertInstanceOf('AnyContent\\Client\\Repository', $record->getRepository());
     $records = $repository->getRecords();
     $record = array_shift($records);
     $this->assertInstanceOf('AnyContent\\Client\\Repository', $record->getRepository());
 }
 /**
  * @param $configTypeName
  *
  * @return \CMDL\ConfigTypeDefinition|ContentTypeDefinition|\CMDL\DataTypeDefinition|null
  * @throws AnyContentClientException
  * @throws \CMDL\CMDLParserException
  */
 public function getConfigTypeDefinition($configTypeName)
 {
     if ($this->getConfiguration()->hasConfigType($configTypeName)) {
         $cacheKey = '[cmdl][config][' . $configTypeName . ']';
         if ($this->repository) {
             $cacheKey = '[' . $this->repository->getName() . ']' . $cacheKey;
         }
         if ($this->getCMDLCache()->contains($cacheKey)) {
             return $this->getCMDLCache()->fetch($cacheKey);
         }
         $cmdl = $this->getCMDLForConfigType($configTypeName);
         if ($cmdl) {
             $parser = $this->getParser();
             $definition = $parser->parseCMDLString($cmdl, $configTypeName, null, 'config');
             if ($definition) {
                 //$this->contentTypeDefinitions[$configTypeName]['definition'] = $definition;
                 $this->getCMDLCache()->save($cacheKey, $definition, (int) $this->cmdlCaching);
                 return $definition;
             }
         }
     }
     throw new AnyContentClientException('Unknown config type ' . $configTypeName);
 }
예제 #19
0
 public function testSortRecords()
 {
     $this->repository->selectContentType('example01');
     $this->repository->sortRecords([10 => 0, 9 => 10, 8 => 10]);
     $records = $this->repository->getRecords();
     $this->assertEquals(10, $records[9]->getParent());
     $this->assertEquals(10, $records[8]->getParent());
     $this->assertEquals(0, $records[10]->getParent());
     $this->assertNull($records[1]->getParent());
     $this->assertNotNull($records[10]->getParent());
     $this->assertEquals(1, $records[9]->getPosition());
     $this->assertEquals(2, $records[8]->getPosition());
     $records = $this->repository->getSortedRecords(0);
     $this->assertEquals([10, 9, 8], array_keys($records));
     $this->assertEquals(2, $records[9]->getLevel());
     $this->assertEquals(2, $records[8]->getLevel());
     $this->assertEquals(1, $records[10]->getLevel());
     $records = $this->repository->getSortedRecords(10);
     $this->assertEquals([9, 8], array_keys($records));
 }
 public function testSaveRecords()
 {
     $this->repository->selectContentType('example01');
     for ($i = 1; $i <= 5; $i++) {
         $record = $this->repository->createRecord('New Record ' . $i);
         $record->setProperty('article', 'Test ' . $i);
         $id = $this->repository->saveRecord($record);
         $this->assertEquals($i, $id);
     }
     $this->repository->selectLanguage('es');
     for ($i = 1; $i <= 5; $i++) {
         $record = $this->repository->createRecord('New Record ' . (5 + $i));
         $record->setProperty('article', 'Test ' . (5 + $i));
         $id = $this->repository->saveRecord($record);
         $this->assertEquals(5 + $i, $id);
     }
     $this->repository->selectWorkspace('live');
     for ($i = 1; $i <= 5; $i++) {
         $record = $this->repository->createRecord('New Record ' . (10 + $i));
         $record->setProperty('article', 'Test ' . (10 + $i));
         $id = $this->repository->saveRecord($record);
         $this->assertEquals(10 + $i, $id);
     }
     $this->repository->reset();
     $c = $this->repository->countRecords();
     $this->assertEquals(5, $c);
     $this->repository->selectLanguage('es');
     $c = $this->repository->countRecords();
     $this->assertEquals(5, $c);
     $this->repository->selectWorkspace('live');
     $c = $this->repository->countRecords();
     $this->assertEquals(5, $c);
     $this->repository->selectLanguage('default');
     $c = $this->repository->countRecords();
     $this->assertEquals(0, $c);
 }
 /**
  * @return null
  */
 protected function getRecords(Repository $repository)
 {
     if (!$this->records) {
         $this->writeln('');
         $this->writeln('Start fetching current effective records');
         $this->writeln('');
         $this->records = $repository->getRecords();
         if ($this->records === false) {
             throw new \Exception('Error fetching current effective records.');
         }
         $this->writeln('Done fetching current effective records');
         $this->writeln('');
     }
     return $this->records;
 }
 public static function setUpBeforeClass()
 {
     if (defined('PHPUNIT_CREDENTIALS_MYSQL_SCHEMALESS_HOST')) {
         $source = __DIR__ . '/../../resources/ContentArchiveExample1/cmdl';
         $target = __DIR__ . '/../../../tmp/MySqlSchemaLessCMDL';
         $fs = new Filesystem();
         if (file_exists($target)) {
             $fs->remove($target);
         }
         $fs->mirror($source, $target);
         $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($target);
         $configuration->setRepositoryName('phpunit');
         $configuration->addContentTypes();
         $database = $configuration->getDatabase();
         $database->execute('DROP TABLE IF EXISTS _cmdl_');
         $database->execute('DROP TABLE IF EXISTS _counter_');
         $database->execute('DROP TABLE IF EXISTS phpunit$profiles');
         $connection = $configuration->createReadWriteConnection();
         $repository = new Repository('phpunit', $connection);
         $repository->selectContentType('profiles');
         $record = $repository->createRecord('Agency 1', 1);
         $repository->saveRecord($record);
         $record = $repository->createRecord('Agency 2', 2);
         $repository->saveRecord($record);
         $record = $repository->createRecord('Agency 5', 5);
         $repository->saveRecord($record);
         $repository->selectWorkspace('live');
         $record = $repository->createRecord('Agency 1', 1);
         $repository->saveRecord($record);
         $record = $repository->createRecord('Agency 2', 2);
         $repository->saveRecord($record);
         KVMLoggerFactory::createWithKLogger(__DIR__ . '/../../../tmp');
     }
 }
 public function testSaveRecords()
 {
     $this->repository->selectContentType('example01');
     $record = $this->repository->createRecord('New Record');
     $record->setProperty('source', 'a');
     $id = $this->repository->saveRecord($record);
     $this->assertEquals(1, $id);
     $record = $this->repository->createRecord('New Record');
     $record->setProperty('source', 'b');
     $id = $this->repository->saveRecord($record);
     $this->assertEquals(2, $id);
     $record = $this->repository->createRecord('Differing Name');
     $record->setProperty('source', 'c');
     $id = $this->repository->saveRecord($record);
     $this->assertEquals(3, $id);
     $records = $this->repository->getRecords('name = New Record');
     $this->assertCount(2, $records);
     $filter1 = new PropertyFilter('name = New Record');
     $filter2 = new PropertyFilter('name = Differing Name');
     $orFilter = new ORFilter([$filter1, $filter2]);
     $records = $this->repository->getRecords($orFilter);
     $this->assertCount(3, $records);
     $records = $this->repository->getRecords('source > b');
     $this->assertCount(1, $records);
     $filter1 = new PropertyFilter('source > a');
     $filter2 = new PropertyFilter('name = Differing Name');
     $andFilter = new ANDFilter([$filter1, $filter2]);
     $records = $this->repository->getRecords($andFilter);
     $this->assertCount(1, $records);
 }
 public function testGetFilteredRecords()
 {
     KVMLogger::instance()->debug(__METHOD__);
     $connection = $this->connection;
     if (!$connection) {
         $this->markTestSkipped('RestLike Basic Connection credentials missing.');
     }
     $repository = new Repository('pidtag', $connection);
     $connection->selectContentType('dtag_searchresult_product');
     $records = $repository->getRecords();
     $this->assertCount(149, $records);
     $records = $repository->getRecords('name *= apple');
     $this->assertCount(10, $records);
     $records = $repository->getRecords('name = banana');
     $this->assertCount(0, $records);
 }
 public static function getBreadcrumb(Repository $repository, $contentTypeName, $recordId)
 {
     $repository->selectContentType($contentTypeName);
     return $repository->getSortedRecords($recordId, true, 0, 99);
 }
 public static function setUpBeforeClass()
 {
     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->setRepositoryName('phpunit');
         $configuration->addContentTypes();
         $database = $configuration->getDatabase();
         $database->execute('DROP TABLE IF EXISTS _cmdl_');
         $database->execute('DROP TABLE IF EXISTS _counter_');
         $database->execute('DROP TABLE IF EXISTS phpunit$profiles');
         $connection = $configuration->createReadWriteConnection();
         $repository = new Repository('phpunit', $connection);
         $repository->selectContentType('profiles');
         $record = $repository->createRecord('dmc digital media center', 5);
         $repository->saveRecord($record);
         $record = $repository->createRecord('Agency 16', 16);
         $repository->saveRecord($record);
         $repository->selectWorkspace('live');
         $record = $repository->createRecord('dmc digital media center', 5);
         $repository->saveRecord($record);
         $repository->selectLanguage('de');
         $record = $repository->createRecord('dmc digital media center', 5);
         $repository->saveRecord($record);
         KVMLoggerFactory::createWithKLogger(__DIR__ . '/../../../tmp');
     }
 }
 public function deleteFolder($path, $deleteIfNotEmpty = false)
 {
     return parent::deleteFolder($path, $deleteIfNotEmpty);
 }
 public function getConfigTypeAccessHash(Repository $repository, $configTypeName)
 {
     return md5($repository->getName() . '-contentType-' . $configTypeName);
 }
 protected static function getDataTypeDefinition(Application $app, Repository $repository, $dataType, $dataTypeAccessHash)
 {
     /** @var RepositoryManager $repositoryManager */
     $repositoryManager = $app['repos'];
     if ($repository) {
         if ($dataType == 'content') {
             /** @var ContentTypeDefinition $dataTypeDefinition */
             $dataTypeDefinition = $repository->getContentTypeDefinition();
             $app['context']->setCurrentContentType($dataTypeDefinition);
         } else {
             /** @var ConfigTypeDefinition $dataTypeDefinition */
             $dataTypeDefinition = $repositoryManager->getConfigTypeDefinitionByConfigTypeAccessHash($dataTypeAccessHash);
             $app['context']->setCurrentConfigType($dataTypeDefinition);
         }
         return $dataTypeDefinition;
     }
     return false;
 }