diff --git a/module/doc/test/doc.class.php b/module/doc/test/doc.class.php
index c5ae47425d..f10263f24d 100644
--- a/module/doc/test/doc.class.php
+++ b/module/doc/test/doc.class.php
@@ -455,13 +455,19 @@ class docTest
return $objects;
}
- public function summaryTest($files)
+ /**
+ * 统计当前页面上文件的数量和大小。
+ * Count the number and size of files on the current page.
+ *
+ * @param array $idList
+ * @access public
+ * @return void
+ */
+ public function summaryTest(array $idList): string
{
- $objects = $this->objectModel->summary($files);
-
- if(dao::isError()) return dao::getError();
-
- return $objects;
+ $files = array();
+ if($idList) $files = $this->objectModel->dao->select('*')->from(TABLE_FILE)->where('id')->in($idList)->fetchAll();
+ return $this->objectModel->summary($files);
}
/**
diff --git a/module/doc/test/model/summary.php b/module/doc/test/model/summary.php
index da01209010..41c2bb3a74 100755
--- a/module/doc/test/model/summary.php
+++ b/module/doc/test/model/summary.php
@@ -1,19 +1,25 @@
#!/usr/bin/env php
summary();
cid=1
-pid=1
-
+- 测试没有附件的情况 @本页共 0 个附件,共计 0B,其中。
+- 测试有附件的情况 @本页共 10 个附件,共计 159.2K,其中txt 1个、doc 1个、docx 1个、dot 1个、wps 1个、wri 1个、pdf 1个、ppt 1个、pptx 1个、xls 1个。
*/
+include dirname(__FILE__, 5) . '/test/lib/init.php';
+include dirname(__FILE__, 2) . '/doc.class.php';
-$doc = new docTest();
+$fileTable = zdTable('file');
+$fileTable->size->range('3244,8416,23854,6567,39421');
+$fileTable->gen(10);
+zdTable('user')->gen(5);
-r($doc->summaryTest()) && p() && e();
\ No newline at end of file
+$fileIds[0] = array();
+$fileIds[1] = range(1, 10);
+
+$docTester = new docTest();
+r($docTester->summaryTest($fileIds[0])) && p() && e('本页共 0 个附件,共计 0B,其中。'); // 测试没有附件的情况
+r($docTester->summaryTest($fileIds[1])) && p() && e('本页共 10 个附件,共计 159.2K,其中txt 1个、doc 1个、docx 1个、dot 1个、wps 1个、wri 1个、pdf 1个、ppt 1个、pptx 1个、xls 1个。'); // 测试有附件的情况