function setUp() { $this->external_repo = new SSLTrackTest_ExternalRepo(); $this->mock_getid3 = $this->getMock('getid3', array('Analyze')); $this->external_repo->getID3 = $this->mock_getid3; Inject::map('ExternalRepo', $this->external_repo); }
public function setUp() { $this->repo = new SSLRealtimeModelTest_SSLRepo(); Inject::map('SSLRepo', $this->repo); $this->tcel = null; $this->rtm = new SSLRealtimeModel(); $this->rtm->addTrackChangeObserver($this); foreach (array(0, 1, 2) as $i) { $this->decks[$i] = $this->getMock('SSLRealtimeModelDeck', array('notify', 'trackStarted', 'trackStopped', 'trackUpdated', 'getCurrentTrack', 'getPreviousTrack'), array($i)); } $this->repo->decks = $this->decks; }
public function setUp() { // tracks $stm_test = new ScrobblerTrackModelTest(); $this->track123_PLAYING = $stm_test->trackMock(123, 300, true, 125); $this->track456_PLAYING = $stm_test->trackMock(456, 300, true, 125); $this->track789_PLAYING = $stm_test->trackMock(789, 300, true, 125); $this->track123_START = $stm_test->trackMock(123, 300, false, 0); $this->track456_START = $stm_test->trackMock(456, 300, false, 0); // deck models $this->stm_factory = new NowPlayingModelTest_SSLRepo(); Inject::map('SSLRepo', $this->stm_factory); $this->now_playing_called = false; $this->now_playing_called_with = null; $this->srm = new NowPlayingModel(); $this->srm->addNowPlayingObserver($this); }
protected function post_process($filename) { echo "post processing {$filename}...\n"; // Use the caching version via Dependency Injection. This means that all // new SSLTracks created using a SSLTrackFactory will get a RuntimeCachingSSLTrack // that knows how to ask the cache about expensive lookups (such as getID3 stuff). Inject::map('SSLTrackFactory', new SSLTrackCache()); $ts = new InstantTickSource(); $hfm = new SSLHistoryFileReplayer($filename); $ism = new ImmediateScrobbleModel(); // deal with PLAYED tracks one by one $ts->addTickObserver($hfm); $hfm->addExitObserver($ts); $hfm->addDiffObserver($ism); // get the PluginWrapper that wraps all other plugins. $pw = $this->plugin_manager->getObservers(); // add all of the PluginWrappers to the various places. $ts->addTickObserver($pw[0]); $hfm->addDiffObserver($pw[0]); $ism->addScrobbleObserver($pw[0]); $this->plugin_manager->onStart(); // Tick tick tick. This only returns if a signal is caught $ts->startClock($this->sleep); $this->plugin_manager->onStop(); }