Skip to content

Commit f3f226b

Browse files
committed
LDEV-5825 build: refactor mail service tests to avoid compile error
1 parent db5374a commit f3f226b

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

test/_setupTestServices.cfc

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ component {
178178
public void function loadServiceConfig() localmode=true {
179179
systemOutput( "", true) ;
180180
systemOutput("-------------- Test Services ------------", true );
181-
services = ListToArray("oracle,MySQL,MSsql,postgres,h2,mongoDb,s3,s3_custom,s3_google,s3_backblaze,ftp,sftp,memcached,redis,ldap,httpbin"); // smtp,pop,imap,
181+
services = ListToArray("oracle,MySQL,MSsql,postgres,h2,mongoDb,s3,s3_custom,s3_google,s3_backblaze,ftp,sftp,memcached,redis,ldap,httpbin,smtp,pop,imap");
182182
// can take a while, so we check them them in parallel
183183

184184
services.each( function( service ) localmode=true {
@@ -341,22 +341,13 @@ component {
341341
}
342342

343343
public function verifySMTP ( smtp, service ) localmode=true {
344-
/*
345344
try {
346-
mail from="[email protected]"
347-
348-
subject="service test"
349-
async=false
350-
server=smtp.SERVER
351-
port=smtp.PORT_INSECURE
352-
username=smtp.USERNAME
353-
password=smtp.PASSWORD {
354-
echo("test suite service test email");
355-
}
345+
getTagData("cf", "mail"); // with throw if mail not installed / available
346+
// call service cfc to test, to avoid compile error, due to tag syntax
347+
services.cfmail::testMail( smtp );
356348
} catch (e) {
357-
throw e.message;
349+
throw(message=e.message, cause=e);
358350
}
359-
*/
360351
return "SMTP Connection Verified";
361352
}
362353

test/services/cfmail.cfc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* with lucee 7.1, mail was moved to an extension,
2+
test here when the tag exists, to avoid compile error */
3+
component {
4+
static function testMail(smtp){
5+
cfmail(from="[email protected]",
6+
7+
subject="service test",
8+
async=false,
9+
server=smtp.SERVER,
10+
port=smtp.PORT_INSECURE,
11+
username=smtp.USERNAME,
12+
password=smtp.PASSWORD) {
13+
echo("test suite service test email");
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)