/** * Creates an instance of Broadcaster if not already created */ private static function initializeBroadcaster() { if (is_null(self::$broadcaster)) { // Create new grader self::$broadcaster = new Broadcaster(); } }
protected function detourBroadcasterCalls($times = null) { if (is_null($times)) { $times = $this->once(); } $broadcasterMock = $this->getMock('Broadcaster', array('broadcastClarification')); $broadcasterMock->expects($times)->method('broadcastClarification'); ClarificationController::$broadcaster = $broadcasterMock; }