Paladin
unread,Nov 21, 2009, 1:07:15 AM11/21/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Joomla! Framework Development
OK, I can load Mocks all day long into JFactory and do things with
Mocks for JSession, JApplication, etc.
But JFactory->getUser behaves differently from the rest. JFactory-
>getSession, for example, doesn't care that the object in the variable
isn't JSession, but is rather Mock_JSession. So I can mock away in my
testing.
But JFactory->getUser() not only picks up the value, but tests to see
if it's actually a JUser reference, instead of an object reference.
Which means any and all attempts to mock it on the fly are rejected.
So the only way to play with *those* calls is with a real JUser
object, and not a mock.
So far it's not fatal, but these little inconsistencies are piling up
the frustration and time. When the time comes to refactor based on
testing, we should take care of them.