public function testInjectApi()
 {
     $client = new EchoNest_Client();
     $artistApiMock = $this->getMockBuilder('EchoNest_ApiInterface')->getMock();
     $client->setApi('artist', $artistApiMock);
     $this->assertSame($artistApiMock, $client->getArtistApi());
 }
Exemple #2
0
 protected static function get_images($artist_name)
 {
     $images = array();
     if (AmpConfig::get('echonest_api_key')) {
         $echonest = new EchoNest_Client(new EchoNest_HttpClient_Requests());
         $echonest->authenticate(AmpConfig::get('echonest_api_key'));
         try {
             $images = $echonest->getArtistApi()->setName($artist_name)->getImages();
         } catch (Exception $e) {
             debug_event('echonest', 'EchoNest artist images error: ' . $e->getMessage(), '1');
         }
     }
     foreach (Plugin::get_plugins('get_photos') as $plugin_name) {
         $plugin = new Plugin($plugin_name);
         if ($plugin->load($GLOBALS['user'])) {
             $images += $plugin->_plugin->get_photos($artist_name);
         }
     }
     return $images;
 }