? Pending

User tests: Successful: Unsuccessful:

avatar PhilETaylor
PhilETaylor
30 Dec 2021

Pull Request for Issue #36478

Summary of Changes

If the Mail Template was not found in the db, we cannot send an email, therefore return false before trying to do lots of things based on the template that doesnt exist and avoid error messages

Testing Instructions

Code review

$mailer = new MailTemplate('com_bftest.invalidtemplateid', 'en-GB');
// ...
$sent = $mailer->send();

Actual result BEFORE applying this Pull Request

Load of PHP notices and a 'Message body empty' warning.

Expected result AFTER applying this Pull Request

// $sent === false
$sent = $mailer->send();

Documentation Changes Required

None

avatar PhilETaylor PhilETaylor - open - 30 Dec 2021
avatar PhilETaylor PhilETaylor - change - 30 Dec 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 30 Dec 2021
Category Libraries
avatar PhilETaylor PhilETaylor - change - 30 Dec 2021
The description was changed
avatar PhilETaylor PhilETaylor - edited - 30 Dec 2021
avatar PhilETaylor PhilETaylor - change - 30 Dec 2021
The description was changed
avatar PhilETaylor PhilETaylor - edited - 30 Dec 2021
avatar PhilETaylor PhilETaylor - change - 30 Dec 2021
Title
If the Mail Template was not found in the db, return false
[4.0] If the Mail Template was not found in the db, return false
avatar PhilETaylor PhilETaylor - edited - 30 Dec 2021
avatar PhilETaylor
PhilETaylor - comment - 30 Dec 2021

I would write a Unit test for this but... ComponentHelper::getParams /facepalm/ and static calls cannot be mocked :(

avatar PhilETaylor PhilETaylor - change - 30 Dec 2021
Labels Added: ?
avatar wilsonge
wilsonge - comment - 31 Dec 2021

I would write a Unit test for this but... ComponentHelper::getParams /facepalm/ and static calls cannot be mocked :(

I mean if you really wanna go ham - which I strongly encourage of course :) You should be able to mock the params in the db I think. I'll see if I can dig out an example tomorrow.

29a36a0 4 Jan 2022 avatar PhilETaylor docs
avatar wilsonge wilsonge - change - 4 Jan 2022
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2022-01-04 17:16:55
Closed_By wilsonge
avatar wilsonge wilsonge - close - 4 Jan 2022
avatar wilsonge wilsonge - merge - 4 Jan 2022
avatar wilsonge
wilsonge - comment - 4 Jan 2022

Thanks!

Add a Comment

Login with GitHub to post a comment