* Refactor doc::getFileIcon unit test.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user