* Refactor doc::getFileIcon unit test.

This commit is contained in:
tianshujie
2023-12-05 15:43:16 +08:00
parent 612701b58a
commit fd43d5479e
2 changed files with 28 additions and 45 deletions
+13 -26
View File
@@ -366,32 +366,6 @@ class docTest
return $counts;
}
/**
* Test get file icon.
*
* @param string $type
* @param int $objectID
* @access public
* @return string
*/
public function getFileIconTest($type, $objectID)
{
$files = $this->objectModel->getLibFiles($type, $objectID, 't1.id_desc', $pager = null);
$objects = $this->objectModel->getFileIcon($files);
if(dao::isError()) return dao::getError();
$icons = '';
foreach($objects as $object)
{
preg_match("/icon-[^']*/", $object, $matches);
$icons .= "$matches[0] ";
}
$icons = trim($icons);
return $icons;
}
/**
* Test get doc tree.
*
@@ -1270,4 +1244,17 @@ class docTest
if(dao::isError()) return dao::getError();
return $data;
}
/**
* 获取文件图标。
* Get file icon.
*
* @access public
* @return array
*/
public function getFileIconTest(): array
{
$files = $this->objectModel->dao->select('*')->from(TABLE_FILE)->fetchAll();
return $this->objectModel->getFileIcon($files);
}
}