|
@@ -391,4 +391,150 @@ class HomeControllerTest extends FunctionalTest
|
391
|
391
|
$this->isResponseNotFound();
|
392
|
392
|
}
|
393
|
393
|
|
|
394
|
+ /**
|
|
395
|
+ * Test de la fonction ajax de récupération de plus d'éléments sur la page
|
|
396
|
+ * de profil
|
|
397
|
+ */
|
|
398
|
+ public function testFilterUserElements()
|
|
399
|
+ {
|
|
400
|
+ $this->client = self::createClient();
|
|
401
|
+ $this->connectUser('paul', 'toor');
|
|
402
|
+
|
|
403
|
+ $paul = $this->getUser();
|
|
404
|
+ $bux = $this->getUser('bux');
|
|
405
|
+
|
|
406
|
+ $hardtek_id = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')
|
|
407
|
+ ->findOneByName('Hardtek')->getId();
|
|
408
|
+ $hardcore_id = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')
|
|
409
|
+ ->findOneByName('Hardcore')->getId();
|
|
410
|
+ $electro_id = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')
|
|
411
|
+ ->findOneByName('Electro')->getId();
|
|
412
|
+ $metal_id = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')
|
|
413
|
+ ->findOneByName('Metal')->getId();
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+ // Ouverture de la page favoris
|
|
417
|
+ $this->crawler = $this->client->request('GET', $this->generateUrl('show_user', array('slug' => $bux->getSlug())));
|
|
418
|
+
|
|
419
|
+ // On doit voir deux elements pour paul
|
|
420
|
+ $this->exist('span.element_name:contains("Ed Cox - La fanfare des teuffeurs (Hardcordian)")');
|
|
421
|
+ $this->exist('span.element_name:contains("Babylon Pression - Des Tasers et des Pauvres")');
|
|
422
|
+ $this->exist('span.element_name:contains("AZYD AZYLUM Live au Café Provisoire")');
|
|
423
|
+ $this->exist('span.element_name:contains("SOULFLY - Prophecy")');
|
|
424
|
+ $this->exist('span.element_name:contains("KoinkOin - H5N1")');
|
|
425
|
+ $this->exist('span.element_name:contains("Antropod - Polakatek")');
|
|
426
|
+ $this->exist('span.element_name:contains("Dtc che passdrop")');
|
|
427
|
+ $this->exist('span.element_name:contains("Heretik System Popof - Resistance")');
|
|
428
|
+
|
|
429
|
+ // Récupération de la liste avec la kekete ajax pour Tribe
|
|
430
|
+ $url = $this->generateUrl('show_elements_get', array(
|
|
431
|
+ 'type' => 'user',
|
|
432
|
+ 'object_id' => $bux->getId(),
|
|
433
|
+ 'tags_ids_json' => json_encode(array($hardtek_id))
|
|
434
|
+ ));
|
|
435
|
+ $this->crawler = $this->client->request('GET', $url, array(), array(), array(
|
|
436
|
+ 'HTTP_X-Requested-With' => 'XMLHttpRequest',
|
|
437
|
+ ));
|
|
438
|
+
|
|
439
|
+ $response_content = json_decode($this->client->getResponse()->getContent(), true);
|
|
440
|
+ $html = $response_content['html'];
|
|
441
|
+
|
|
442
|
+ $this->assertTrue(strpos($html, 'Ed Cox - La fanfare des teuffeurs (Hardcordian)') === false);
|
|
443
|
+ $this->assertTrue(strpos($html, 'Babylon Pression - Des Tasers et des Pauvres') === false);
|
|
444
|
+ $this->assertTrue(strpos($html, 'AZYD AZYLUM Live au Café Provisoire') === false);
|
|
445
|
+ $this->assertTrue(strpos($html, 'SOULFLY - Prophecy') === false);
|
|
446
|
+ $this->assertTrue(strpos($html, 'KoinkOin - H5N1') !== false);
|
|
447
|
+ $this->assertTrue(strpos($html, 'Antropod - Polakatek') !== false);
|
|
448
|
+ $this->assertTrue(strpos($html, 'Dtc che passdrop') !== false);
|
|
449
|
+ $this->assertTrue(strpos($html, 'Heretik System Popof - Resistance') !== false);
|
|
450
|
+
|
|
451
|
+ // Récupération de la liste avec la kekete ajax pour Hardtek
|
|
452
|
+ $url = $this->generateUrl('show_elements_get', array(
|
|
453
|
+ 'type' => 'user',
|
|
454
|
+ 'object_id' => $bux->getId(),
|
|
455
|
+ 'tags_ids_json' => json_encode(array($metal_id))
|
|
456
|
+ ));
|
|
457
|
+
|
|
458
|
+ $this->crawler = $this->client->request('GET', $url, array(), array(), array(
|
|
459
|
+ 'HTTP_X-Requested-With' => 'XMLHttpRequest',
|
|
460
|
+ ));
|
|
461
|
+
|
|
462
|
+ $this->isResponseSuccess();
|
|
463
|
+
|
|
464
|
+ $response_content = json_decode($this->client->getResponse()->getContent(), true);
|
|
465
|
+ $html = $response_content['html'];
|
|
466
|
+
|
|
467
|
+ $this->assertTrue(strpos($html, 'Ed Cox - La fanfare des teuffeurs (Hardcordian)') === false);
|
|
468
|
+ $this->assertTrue(strpos($html, 'Babylon Pression - Des Tasers et des Pauvres') !== false);
|
|
469
|
+ $this->assertTrue(strpos($html, 'AZYD AZYLUM Live au Café Provisoire') !== false);
|
|
470
|
+ $this->assertTrue(strpos($html, 'SOULFLY - Prophecy') !== false);
|
|
471
|
+ $this->assertTrue(strpos($html, 'KoinkOin - H5N1') === false);
|
|
472
|
+ $this->assertTrue(strpos($html, 'Antropod - Polakatek') === false);
|
|
473
|
+ $this->assertTrue(strpos($html, 'Dtc che passdrop') === false);
|
|
474
|
+ $this->assertTrue(strpos($html, 'Heretik System Popof - Resistance') === false);
|
|
475
|
+
|
|
476
|
+ // Récupération de la liste avec la kekete ajax pour Tribe + Hardtek
|
|
477
|
+ $url = $this->generateUrl('show_elements_get', array(
|
|
478
|
+ 'type' => 'user',
|
|
479
|
+ 'object_id' => $bux->getId(),
|
|
480
|
+ 'tags_ids_json' => json_encode(array($hardtek_id, $hardcore_id, $electro_id, $metal_id))
|
|
481
|
+ ));
|
|
482
|
+
|
|
483
|
+ $this->crawler = $this->client->request('GET', $url, array(), array(), array(
|
|
484
|
+ 'HTTP_X-Requested-With' => 'XMLHttpRequest',
|
|
485
|
+ ));
|
|
486
|
+
|
|
487
|
+ $this->isResponseSuccess();
|
|
488
|
+
|
|
489
|
+ $response_content = json_decode($this->client->getResponse()->getContent(), true);
|
|
490
|
+ $html = $response_content['html'];
|
|
491
|
+
|
|
492
|
+ $this->assertTrue(strpos($html, 'Ed Cox - La fanfare des teuffeurs (Hardcordian)') !== false);
|
|
493
|
+ $this->assertTrue(strpos($html, 'Babylon Pression - Des Tasers et des Pauvres') !== false);
|
|
494
|
+ $this->assertTrue(strpos($html, 'AZYD AZYLUM Live au Café Provisoire') !== false);
|
|
495
|
+ $this->assertTrue(strpos($html, 'SOULFLY - Prophecy') !== false);
|
|
496
|
+ $this->assertTrue(strpos($html, 'KoinkOin - H5N1') !== false);
|
|
497
|
+ $this->assertTrue(strpos($html, 'Antropod - Polakatek') !== false);
|
|
498
|
+ $this->assertTrue(strpos($html, 'Dtc che passdrop') !== false);
|
|
499
|
+ $this->assertTrue(strpos($html, 'Heretik System Popof - Resistance') !== false);
|
|
500
|
+ }
|
|
501
|
+
|
|
502
|
+ /**
|
|
503
|
+ * Test de la fonction ajax de récupération de plus d'éléments sur la page
|
|
504
|
+ * de profil
|
|
505
|
+ */
|
|
506
|
+ public function testFilterGroupElements()
|
|
507
|
+ {
|
|
508
|
+ $this->client = self::createClient();
|
|
509
|
+ $this->connectUser('paul', 'toor');
|
|
510
|
+
|
|
511
|
+ $paul = $this->getUser();
|
|
512
|
+ $group = $this->getGroup('dudeldrum');
|
|
513
|
+
|
|
514
|
+ $medieval_id = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')
|
|
515
|
+ ->findOneByName('Medieval')->getId();
|
|
516
|
+
|
|
517
|
+ // Ouverture de la page favoris
|
|
518
|
+ $this->crawler = $this->client->request('GET', $this->generateUrl('show_group', array('slug' => $group->getSlug())));
|
|
519
|
+
|
|
520
|
+ // On doit voir deux elements pour paul
|
|
521
|
+ $this->exist('span.element_name:contains("DUDELDRUM")');
|
|
522
|
+
|
|
523
|
+ // Récupération de la liste avec la kekete ajax pour Tribe
|
|
524
|
+ $url = $this->generateUrl('show_elements_get', array(
|
|
525
|
+ 'type' => 'group',
|
|
526
|
+ 'object_id' => $group->getId(),
|
|
527
|
+ 'tags_ids_json' => json_encode(array($medieval_id))
|
|
528
|
+ ));
|
|
529
|
+ $this->crawler = $this->client->request('GET', $url, array(), array(), array(
|
|
530
|
+ 'HTTP_X-Requested-With' => 'XMLHttpRequest',
|
|
531
|
+ ));
|
|
532
|
+
|
|
533
|
+ $response_content = json_decode($this->client->getResponse()->getContent(), true);
|
|
534
|
+ $html = $response_content['html'];
|
|
535
|
+
|
|
536
|
+ $this->assertTrue(strpos($html, 'DUDELDRUM') !== false);
|
|
537
|
+
|
|
538
|
+ }
|
|
539
|
+
|
394
|
540
|
}
|