/** * tx_dam::process_renameFile() */ public function test_process_renameFile() { $this->removeFixtureTempFiles(); $this->removeIndexSetup(); $this->removeFixturesFromIndex(); $this->addFixturePathToFilemount(); $filepath = $this->getFixtureTempFilename(); $uid = tx_dam::file_isIndexed($filepath); self::assertNoUID($uid, 'File index found, but shouldn\'t'); tx_dam::config_setValue('setup.indexing.auto', true); $indexed = tx_dam::index_autoProcess($filepath, $reindex = false); self::assertTrue(isset($indexed['isIndexed']), 'File not indexed'); $uid = $indexed['fields']['uid']; $filepathNew = $filepath . '.doc'; $error = tx_dam::process_renameFile($filepath, tx_dam::file_basename($filepathNew)); if ($error) { debug($error); } self::assertTrue(is_file($filepathNew), 'File not renamed'); $uid2 = tx_dam::file_isIndexed($filepathNew); self::assertUID($uid2, 'File index not found'); self::assertEquals(intval($uid), intval($uid2), 'Wrong uid: ' . $uid . ' - ' . $uid2); $data = tx_dam::meta_getDataByUid($uid); self::assertEquals($data['file_name'], tx_dam::file_basename($filepathNew), 'Wrong file name ' . $indexed['fields']['file_name'] . ' != ' . tx_dam::file_basename($filepathNew)); $this->removeFixturePathFromFilemount(); $this->removeFixturesFromIndex(); $this->removeIndexSetup(); $this->removeFixtureTempFiles(); }
/** * tx_dam::config_setValue() */ public function test_config_setValue() { tx_dam::config_init(); tx_dam::config_setValue('setup.indexing.auto', true); $value = tx_dam::config_getValue('setup.indexing.auto'); self::assertEquals($value, true); tx_dam::config_setValue('setup.indexing.auto', false); $value = tx_dam::config_getValue('setup.indexing.auto'); self::assertEquals($value, false); }
} // that's the base API require_once PATH_txdam . 'lib/class.tx_dam.php'; // include basic image stuff because it's used so often require_once PATH_txdam . 'lib/class.tx_dam_image.php'; // get extension setup $TYPO3_CONF_VARS['EXTCONF']['dam']['setup'] = unserialize($_EXTCONF); if ($TYPO3_CONF_VARS['EXTCONF']['dam']['setup']['tsconfig'] === 'default') { t3lib_extMgm::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:dam/tsconfig/default.txt">'); } elseif ($TYPO3_CONF_VARS['EXTCONF']['dam']['setup']['tsconfig'] === 'minimal') { t3lib_extMgm::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:dam/tsconfig/minimal.txt">'); } elseif ($TYPO3_CONF_VARS['EXTCONF']['dam']['setup']['tsconfig'] === 'example') { t3lib_extMgm::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:dam/tsconfig/example.txt">'); } // set some config values from extension setup tx_dam::config_setValue('setup.devel', $TYPO3_CONF_VARS['EXTCONF']['dam']['setup']['devel']); // register default icons tx_dam::register_fileIconPath(PATH_txdam . 'i/18/', 'FE'); tx_dam::register_fileIconPath(PATH_txdam . 'i/18/', 'BE'); // would register TYPO3's default file icons # tx_dam::register_fileIconPath(PATH_typo3.'gfx/fileicons/', 'BE'); // field templates for usage in other tables to link media records require_once PATH_txdam . 'tca_media_field.php'; // register XCLASS of t3lib_extfilefunc to pipe all TCE stuff through DAM version $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_extfilefunc.php'] = PATH_txdam . 'lib/class.tx_dam_tce_file.php'; // setup interface to htmlArea RTE if ($TYPO3_CONF_VARS['EXTCONF']['dam']['setup']['htmlAreaBrowser']) { require_once PATH_txdam . 'compat/ext_localconf.php'; } // register show item rendering $TYPO3_CONF_VARS['SC_OPTIONS']['typo3/show_item.php']['typeRendering'][] = 'EXT:dam/binding/be/class.tx_dam_show_item.php:&tx_dam_show_item';
/** * tx_dam::index_autoProcess() */ public function test_index_autoProcess() { $this->activateIndexSetup('set_keyword'); $this->removeFixturesFromIndex(); $this->addFixturePathToFilemount(); $filepath = $this->getFixtureFilename('iptc'); $uid = tx_dam::file_isIndexed($filepath); self::assertFalse($uid, 'File index found, but shouldn\'t'); tx_dam::config_setValue('setup.indexing.auto', false); $indexed = tx_dam::index_autoProcess($filepath, $reindex = false); self::assertFalse(isset($indexed['isIndexed']), 'File IS indexed but shouldn\'t'); tx_dam::config_setValue('setup.indexing.auto', true); $indexed = tx_dam::index_autoProcess($filepath, $reindex = false); self::assertTrue(isset($indexed['isIndexed']), 'File not indexed'); $meta = tx_dam::meta_getDataByUid($indexed['fields']['uid'], '*'); // keyword is set in auto indexing setup: dam/tests/fixtures/.indexing.setup.xml self::assertEquals($meta['keywords'], 'TEST', 'Wrong keyword: ' . $meta['keywords']); $date = date('d.m.Y', $meta['date_cr']); self::assertEquals($date, '04.07.2006', 'Wrong date: ' . $date); self::assertEquals($meta['title'], 'Hummelflug', 'Wrong title: ' . $meta['title']); self::assertEquals($meta['file_hash'], '184e454250f6f606a1dba14b5c7b38c5', 'Wrong file_hash: ' . $meta['file_hash']); self::assertEquals(intval($meta['media_type']), TXDAM_mtype_image, 'Wrong media_type: ' . $meta['media_type']); self::assertEquals($meta['file_type'], 'jpg', 'Wrong file_type: ' . $meta['file_type']); self::assertEquals($meta['file_mime_type'], 'image', 'Wrong file_mime_type: ' . $meta['file_mime_type']); self::assertEquals($meta['file_mime_subtype'], 'jpeg', 'Wrong file_mime_subtype: ' . $meta['file_mime_subtype']); self::assertTrue((bool) $meta['hpixels'], 'Missing value'); self::assertTrue((bool) $meta['vpixels'], 'Missing value'); self::assertTrue((bool) $meta['hres'], 'Missing value'); self::assertTrue((bool) $meta['vres'], 'Missing value'); self::assertTrue((bool) $meta['width'], 'Missing value'); self::assertTrue((bool) $meta['height'], 'Missing value'); self::assertTrue((bool) $meta['height_unit'], 'Missing value'); $this->removeFixturePathFromFilemount(); $this->removeFixturesFromIndex(); $this->removeIndexSetup(); }
/** * tx_dam::config_getValue() */ public function test_config_getValue() { tx_dam::config_setValue('setup.indexing.auto', true); $value = tx_dam::config_getValue('setup.indexing', true); self::assertTrue($value['auto']); }