? ? Success

User tests: Successful: Unsuccessful:

avatar mbabker
mbabker
27 Aug 2016

Summary of Changes

The current test class pollutes the global state by:

  • Changing the default system timezone for the process without restoring the original value
  • Loading objects into JFactory without resetting state
  • Changing the static $format variable of JDate

The current test class can be considered flaky because:

  • It does not mock JLanguage and is therefore reliant on the system environment variables; if the test class is run with a non-English language configured it would fail

The test class is rewritten to:

  • Restore global state when it makes changes
  • No longer extend TestCaseDatabase; a database connection is NOT required for this test class
  • Inject a mock database into the toSql tests instead of relying on a database connection from JFactory
  • Instructs all tests dealing with formatting to NOT translate the values (this one is more tricky than injecting a mock language instance into JFactory; the system mock we have by default simply returns the string it is given so it is pretty much reliant on a "real" JLanguage instance)

Testing Instructions

Ensure the unit tests pass

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 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:27:26
Closed_By wilsonge

Add a Comment

Login with GitHub to post a comment