|
@@ -1296,4 +1296,65 @@ class ElementControllerTest extends FunctionalTest
|
1296
|
1296
|
|
1297
|
1297
|
}
|
1298
|
1298
|
|
|
1299
|
+ public function testDatasApi()
|
|
1300
|
+ {
|
|
1301
|
+ $this->client = self::createClient();
|
|
1302
|
+ $this->connectUser('joelle', 'toor');
|
|
1303
|
+
|
|
1304
|
+ $joelle = $this->getUser();
|
|
1305
|
+ $url = $this->generateUrl('element_retrieve_api_datas');
|
|
1306
|
+
|
|
1307
|
+ $crawler = $this->client->request(
|
|
1308
|
+ 'POST',
|
|
1309
|
+ $url,
|
|
1310
|
+ array(
|
|
1311
|
+ 'url' => 'http://www.jamendo.com/fr/album/30661'
|
|
1312
|
+ ),
|
|
1313
|
+ array(),
|
|
1314
|
+ array('HTTP_X-Requested-With' => 'XMLHttpRequest')
|
|
1315
|
+ );
|
|
1316
|
+
|
|
1317
|
+ $this->isResponseSuccess();
|
|
1318
|
+
|
|
1319
|
+ $response = json_decode($this->client->getResponse()->getContent(), true);
|
|
1320
|
+ $this->assertEquals(array(
|
|
1321
|
+ 'status' => 'success',
|
|
1322
|
+ 'name' => 'ZwaNe 01 - Ptit lutin',
|
|
1323
|
+ 'tags' => array(
|
|
1324
|
+ 0 => array(
|
|
1325
|
+ 'original_name' => 'Basse',
|
|
1326
|
+ 'like_found' => false,
|
|
1327
|
+ 'like' => array()
|
|
1328
|
+ ),
|
|
1329
|
+ 1 => array(
|
|
1330
|
+ 'original_name' => 'Batterie',
|
|
1331
|
+ 'like_found' => true,
|
|
1332
|
+ 'like' => array(
|
|
1333
|
+ 'name' => 'Batterie',
|
|
1334
|
+ 'id' => '495',
|
|
1335
|
+ 'slug' => 'batterie',
|
|
1336
|
+ )
|
|
1337
|
+ ),
|
|
1338
|
+ 2 => array(
|
|
1339
|
+ 'original_name' => 'Hardtek',
|
|
1340
|
+ 'like_found' => true,
|
|
1341
|
+ 'like' => array(
|
|
1342
|
+ 'name' => 'Hardtek',
|
|
1343
|
+ 'id' => '174',
|
|
1344
|
+ 'slug' => 'hardtek',
|
|
1345
|
+ )
|
|
1346
|
+ ),
|
|
1347
|
+ 3 => array(
|
|
1348
|
+ 'original_name' => 'Tek',
|
|
1349
|
+ 'like_found' => false,
|
|
1350
|
+ 'like' => array()
|
|
1351
|
+ ),
|
|
1352
|
+ ),
|
|
1353
|
+ 'thumb' => 'http://imgjam.com/albums/s30/30661/covers/1.100.jpg'
|
|
1354
|
+ ), $response);
|
|
1355
|
+
|
|
1356
|
+
|
|
1357
|
+
|
|
1358
|
+ }
|
|
1359
|
+
|
1299
|
1360
|
}
|