? ? Success

User tests: Successful: Unsuccessful:

avatar mbabker
mbabker
27 Aug 2016

Summary of Changes

JHtmlDate::relative() will compare a time against "now" if a comparison time is not injected, however previously this would test against a JDate object pulled from the JFactory::$dates cache which could cause minor unexpected results on a long running process (specifically if comparing a time under a minute in difference, see the now uncommented unit test case). The method will now always use a new JDate instance for "now" instead of pulling a potentially cached object.

JHtmlDateTest is improved by:

  • Creating new JDate instances instead of polluting the global cache by calling JFactory::getDate()
  • Running the test case for "less than a minute ago" since cached objects are no longer used
  • Direct calling the method instead of relying on the JHtml::_() method resolver (causes additional unneeded code to be ran and tested)

Testing Instructions

The return values for JHtmlDate::relative() will return as compared to when the method is triggered. No longer does it compare against the time the "now" object was stored to JFactory::$dates. This may cause a difference of seconds on some comparisons, this would be especially noticeable in a longer running process.

Documentation Changes Required

N/A

avatar mbabker mbabker - open - 27 Aug 2016
avatar mbabker mbabker - change - 27 Aug 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 27 Aug 2016
Labels Added: ? ?
avatar joomla-cms-bot joomla-cms-bot - change - 27 Aug 2016
Category Libraries Unit Tests
avatar wilsonge wilsonge - change - 28 Aug 2016
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2016-08-28 00:22:08
Closed_By wilsonge

Add a Comment

Login with GitHub to post a comment