Solved problem where "createdBy" value is overwritten by ThreadManager->doCreatedByAndAt()

It was a number of bug here but the most severe one was that isset($thread->createdBy) will always evaluate to false. 

To reproduce the bug you could add a participant (A) as "createdBy" before the doCreatedByAndAt() is called. Your participant (A) will be replaced by the creator of the first message. 

I added a new test class as well.