From 23e35902f65106e50c19347cb89ffd8bce40681d Mon Sep 17 00:00:00 2001 From: liugang Date: Mon, 24 Nov 2025 20:28:14 +0800 Subject: [PATCH] + [misc] Add unit tests for convertTao::processJiraContent() method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .../convert/test/tao/processjiracontent.php | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 module/convert/test/tao/processjiracontent.php diff --git a/module/convert/test/tao/processjiracontent.php b/module/convert/test/tao/processjiracontent.php new file mode 100755 index 0000000000..43909c7df6 --- /dev/null +++ b/module/convert/test/tao/processjiracontent.php @@ -0,0 +1,48 @@ +#!/usr/bin/env php + image +- 执行convertTest模块的processJiraContentTest方法,参数是'Two images: !screenshot.png|thumb! and !image.jpg|width=100!', $fileList2 @Two images: processjiracontent.php?m=file&f=read&t=png&fileID=1 and processjiracontent.php?m=file&f=read&t=jpg&fileID=2 +- 执行convertTest模块的processJiraContentTest方法,参数是'Missing file: !notfound.png|thumb!', $fileList3 @Missing file: !notfound.png|thumb! +- 执行convertTest模块的processJiraContentTest方法,参数是'No image markers here', $fileList1 @0 +- 执行convertTest模块的processJiraContentTest方法,参数是'Image with options !screenshot.png|width=100, height=80! here', $fileList1 @Image with options processjiracontent.php?m=file&f=read&t=png&fileID=1 here + +*/ + +include dirname(__FILE__, 5) . '/test/lib/init.php'; +include dirname(__FILE__, 2) . '/lib/tao.class.php'; + +su('admin'); + +$convertTest = new convertTaoTest(); + +// 准备测试数据 +$file1 = new stdClass(); +$file1->id = 1; +$file1->extension = 'png'; + +$file2 = new stdClass(); +$file2->id = 2; +$file2->extension = 'jpg'; + +$file3 = new stdClass(); +$file3->id = 3; +$file3->extension = 'gif'; + +$fileList1 = array('screenshot.png' => $file1); +$fileList2 = array('screenshot.png' => $file1, 'image.jpg' => $file2); +$fileList3 = array(); + +r($convertTest->processJiraContentTest('', array())) && p() && e('0'); +r($convertTest->processJiraContentTest('This is a test !screenshot.png|thumbnail! image', $fileList1)) && p() && e('This is a test processjiracontent.php?m=file&f=read&t=png&fileID=1 image'); +r($convertTest->processJiraContentTest('Two images: !screenshot.png|thumb! and !image.jpg|width=100!', $fileList2)) && p() && e('Two images: processjiracontent.php?m=file&f=read&t=png&fileID=1 and processjiracontent.php?m=file&f=read&t=jpg&fileID=2'); +r($convertTest->processJiraContentTest('Missing file: !notfound.png|thumb!', $fileList3)) && p() && e('Missing file: !notfound.png|thumb!'); +r($convertTest->processJiraContentTest('No image markers here', $fileList1)) && p() && e('0'); +r($convertTest->processJiraContentTest('Image with options !screenshot.png|width=100,height=80! here', $fileList1)) && p() && e('Image with options processjiracontent.php?m=file&f=read&t=png&fileID=1 here'); \ No newline at end of file