Skip to content

Commit

Permalink
Merge pull request #2251 from zspitzer/LDEV-1868-5.4
Browse files Browse the repository at this point in the history
LDEV-1868 fix cfapplication mailservers (5.4)
  • Loading branch information
zspitzer authored Sep 29, 2023
2 parents f6194a2 + 6b9ff36 commit f85445e
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 31 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/lucee/runtime/tag/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public void setLogs(Struct logs) {
this.logs = logs;
}

public void setMails(Array mails) {
public void setMailservers(Array mails) {
this.mails = mails;
}

Expand Down
61 changes: 61 additions & 0 deletions test/tickets/LDEV1868.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
component extends="org.lucee.cfml.test.LuceeTestCase" skip=true {
function run( testResults , testBox ) {
describe( "Test case for LDEV-1868", function() {
it( title='Checking Application context for MailSettings', body=function( currentSpec ) {
defineMailSettings_mailservers(25, false, false);
var settings = getApplicationSettings();
assertEquals(25, settings.mails[1].port);
assertEquals(false, settings.mails[1].tls);
assertEquals(false, settings.mails[1].ssl);

defineMailSettings_mailservers(587, true, true);
var settings = getApplicationSettings();
assertEquals(587, settings.mails[1].port);
assertEquals(true, settings.mails[1].tls);
assertEquals(true, settings.mails[1].ssl);
});

it( title='Checking Application context for Mail', body=function( currentSpec ) {
defineMailSettings_mails(25, false, false);
var settings = getApplicationSettings();
assertEquals(25, settings.mails[1].port);
assertEquals(false, settings.mails[1].tls);
assertEquals(false, settings.mails[1].ssl);

defineMailSettings_mails(587, true, true);
var settings = getApplicationSettings();
assertEquals(587, settings.mails[1].port);
assertEquals(true, settings.mails[1].tls);
assertEquals(true, settings.mails[1].ssl);
});
});
}

private void function defineMailSettings_mailservers(port, tls, ssl){
application action="update"
mailservers =[ {
server :"smtp.mail.com"
, port: arguments.port
, userName:"[email protected]"
, password:"password"
, useTLS:arguments.tls
, useSSL:arguments.ssl
, lifeTimespan: createTimeSpan(0,0,1,0)
, idleTimespan: createTimeSpan(0,0,2,0)
}];
}

private void function defineMailSettings_mails(port, tls, ssl){
application action="update"
mails =[ {
server :"smtp.mail.com"
, port: arguments.port
, userName:"[email protected]"
, password:"password"
, useTLS:arguments.tls
, useSSL:arguments.ssl
, lifeTimespan: createTimeSpan(0,0,1,0)
, idleTimespan: createTimeSpan(0,0,2,0)
}];
}
}
30 changes: 0 additions & 30 deletions test/tickets/_LDEV1868.cfc

This file was deleted.

0 comments on commit f85445e

Please sign in to comment.