Getting bit by inconsistency again

0 views
Skip to first unread message

Paladin

unread,
Nov 21, 2009, 1:07:15 AM11/21/09
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.
Reply all
Reply to author
Forward
0 new messages