From bc564dbf1e2b9db4caa7a834fd4ecdc7fb98c95e Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 20 Dec 2023 19:40:54 +0800 Subject: [PATCH] * Add unit test for isclickable. --- module/mail/test/model/isclickable.php | 31 ++++++++++++++++++++++++++ module/mail/test/model/sendmail.php | 8 ++++--- 2 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 module/mail/test/model/isclickable.php diff --git a/module/mail/test/model/isclickable.php b/module/mail/test/model/isclickable.php new file mode 100644 index 0000000000..092455f223 --- /dev/null +++ b/module/mail/test/model/isclickable.php @@ -0,0 +1,31 @@ +#!/usr/bin/env php +isClickable(); +cid=0 + +- 不传入method参数 @0 +- 传入method=delete参数 @1 +- 传入method=resend参数 @0 +- 传入method=resend参数, item的status字段为fail @1 + +*/ +include dirname(__FILE__, 5) . '/test/lib/init.php'; +su('admin'); + +zdTable('notify')->gen(2); + +global $tester; +$mailModel = $tester->loadModel('mail'); +$mailModel->app->user->admin = true; + +$notify = $mailModel->getQueueById(1); + +r($mailModel->isClickable($notify, '')) && p() && e('0'); //不传入method参数 +r($mailModel->isClickable($notify, 'delete')) && p() && e('1'); //传入method=delete参数 +r($mailModel->isClickable($notify, 'resend')) && p() && e('0'); //传入method=resend参数 + +$notify->status = 'fail'; +r($mailModel->isClickable($notify, 'resend')) && p() && e('1'); //传入method=resend参数, item的status字段为fail diff --git a/module/mail/test/model/sendmail.php b/module/mail/test/model/sendmail.php index f91407596a..168eb04967 100755 --- a/module/mail/test/model/sendmail.php +++ b/module/mail/test/model/sendmail.php @@ -4,10 +4,12 @@ /** title=测试 mailModel->sendmail(); -cid=1 -pid=1 +cid=0 -测试为dev4用户发送邮件通知 >> 0 +- 不传入任何参数 @0 +- 只传入actionID @0 +- 只传入objectID @0 +- 测试为需求2发送邮件通知 @0 */ include dirname(__FILE__, 5) . '/test/lib/init.php';