Ejemplo n.º 1
0
 public function testGetCategory()
 {
     $artist = new Artist();
     $artist->setPopularity(50);
     $category = $artist->getCategory();
     $this->assertEquals($category, 'Star');
 }
Ejemplo n.º 2
0
 public function testGetCategory()
 {
     $nena = new Artist();
     $nena->setPopularite(5);
     $icone = "Icône";
     $ss = "Super-Star";
     $star = "Star";
     $chanteur = "Chanteur";
     $bad = "Artiste peu connu";
     $result = $nena->getCategory();
     $this->assertEquals($bad, $result);
 }
Ejemplo n.º 3
0
 public function saveAction($id)
 {
     $url = 'https://api.spotify.com/v1/artists/' . $id;
     $data = file_get_contents($url);
     $artist_array = json_decode($data, true);
     $artist = new Artist();
     $artist->setName($artist_array['name']);
     $artist->setPhoto($artist_array['images'][2]['url']);
     $artist->setExternalId($artist_array['id']);
     $artist->setGenres($artist_array['genres']);
     $artist->setPopularity($artist_array['popularity']);
     $artist->setExternalLink($artist_array['external_urls']['spotify']);
     $doctrine = $this->getDoctrine();
     $em = $doctrine->getManager();
     $em->persist($artist);
     $em->flush();
     return $this->redirect($this->generateUrl('afpa_artist_voir', array('id' => $id)));
 }