|
|
|
|
9
|
class ShowControllerTest extends FunctionalTest
|
9
|
class ShowControllerTest extends FunctionalTest
|
10
|
{
|
10
|
{
|
11
|
|
11
|
|
12
|
-// public function testViewMoreOnProfile()
|
|
|
13
|
-// {
|
|
|
14
|
-// $this->client = self::createClient();
|
|
|
15
|
-// $this->connectUser('bux', 'toor');
|
|
|
16
|
-//
|
|
|
17
|
-// $bux = $this->getUser();
|
|
|
18
|
-//
|
|
|
19
|
-// $hardtek_id = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')->findOneByName('Hardtek')->getId();
|
|
|
20
|
-// $tribe_id = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')->findOneByName('Tribe')->getId();
|
|
|
21
|
-//
|
|
|
22
|
-// // En premier lieux on va devoir ajouter des éléments.
|
|
|
23
|
-// $this->addElementAjax('PoPElement 1', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)));
|
|
|
24
|
-// $this->addElementAjax('PoPElement 2', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)));
|
|
|
25
|
-// $this->addElementAjax('PoPElement 3', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)));
|
|
|
26
|
-// $this->addElementAjax('PoPElement 4', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)));
|
|
|
27
|
-//
|
|
|
28
|
-// // D'après les fixtures on aura 2 éléments en plus des 10 (paramétre) de la page
|
|
|
29
|
-// // Ouverture de la page profil
|
|
|
30
|
-// $this->crawler = $this->client->request('GET', $this->generateUrl('show_user', array('slug' => $bux->getSlug())));
|
|
|
31
|
-// $this->isResponseSuccess();
|
|
|
32
|
-//
|
|
|
33
|
-// $this->exist('span.element_name:contains("PoPElement 4")');
|
|
|
34
|
-// $this->exist('span.element_name:contains("PoPElement 3")');
|
|
|
35
|
-// $this->exist('span.element_name:contains("PoPElement 2")');
|
|
|
36
|
-// $this->exist('span.element_name:contains("PoPElement 1")');
|
|
|
37
|
-// $this->exist('span.element_name:contains("Ed Cox - La fanfare des teuffeurs (Hardcordian)")');
|
|
|
38
|
-// $this->exist('span.element_name:contains("Babylon Pression - Des Tasers et des Pauvres")');
|
|
|
39
|
-// $this->exist('span.element_name:contains("AZYD AZYLUM Live au Café Provisoire")');
|
|
|
40
|
-// $this->exist('span.element_name:contains("SOULFLY - Prophecy")');
|
|
|
41
|
-// $this->exist('span.element_name:contains("KoinkOin - H5N1")');
|
|
|
42
|
-// $this->exist('span.element_name:contains("Antropod - Polakatek")');
|
|
|
43
|
-// $this->notExist('span.element_name:contains("Dtc che passdrop")');
|
|
|
44
|
-// $this->notExist('span.element_name:contains("Heretik System Popof - Resistance")');
|
|
|
45
|
-//
|
|
|
46
|
-// // L'élément de référence est celui en bas de la liste
|
|
|
47
|
-// $element = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
|
|
|
48
|
-// ->findOneByName('Antropod - Polakatek')
|
|
|
49
|
-// ;
|
|
|
50
|
-// $tags = $this->getDoctrine()->getRepository('MuzichCoreBundle:User')
|
|
|
51
|
-// ->getElementsTags($bux->getId(), $bux->getId())
|
|
|
52
|
-// ;
|
|
|
53
|
-//
|
|
|
54
|
-// $ids = array();
|
|
|
55
|
-// foreach ($tags as $tag)
|
|
|
56
|
-// {
|
|
|
57
|
-// $ids[] = $tag->getId();
|
|
|
58
|
-// }
|
|
|
59
|
-//
|
|
|
60
|
-// // On fait la demande pour en voir plus
|
|
|
61
|
-// $url = $this->generateUrl('show_elements_get', array(
|
|
|
62
|
-// 'type' => 'user',
|
|
|
63
|
-// 'object_id' => $bux->getId(),
|
|
|
64
|
-// 'tags_ids_json' => json_encode($ids),
|
|
|
65
|
-// 'id_limit' => $element->getId()
|
|
|
66
|
-// ));
|
|
|
67
|
-// $crawler = $this->client->request(
|
|
|
68
|
-// 'GET',
|
|
|
69
|
-// $url,
|
|
|
70
|
-// array(),
|
|
|
71
|
-// array(),
|
|
|
72
|
-// array('HTTP_X-Requested-With' => 'XMLHttpRequest')
|
|
|
73
|
-// );
|
|
|
74
|
-//
|
|
|
75
|
-// $response = json_decode($this->client->getResponse()->getContent(), true);
|
|
|
76
|
-// $this->assertEquals($response['status'], 'success');
|
|
|
77
|
-// $this->assertTrue(strpos($response['html'], 'Dtc che passdrop') !== false);
|
|
|
78
|
-// $this->assertTrue(strpos($response['html'], 'Heretik System Popof - Resistance') !== false);
|
|
|
79
|
-// }
|
|
|
80
|
-//
|
|
|
81
|
-// public function testViewMoreOnGroup()
|
|
|
82
|
-// {
|
|
|
83
|
-// $this->client = self::createClient();
|
|
|
84
|
-// $this->connectUser('bux', 'toor');
|
|
|
85
|
-//
|
|
|
86
|
-// $bux = $this->getUser();
|
|
|
87
|
-// $fan_de_psy = $this->getDoctrine()->getRepository('MuzichCoreBundle:Group')->findOneByName('Fans de psytrance');
|
|
|
88
|
-//
|
|
|
89
|
-// $hardtek_id = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')->findOneByName('Hardtek')->getId();
|
|
|
90
|
-// $tribe_id = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')->findOneByName('Tribe')->getId();
|
|
|
91
|
-//
|
|
|
92
|
-// // En premier lieux on va devoir ajouter des éléments.
|
|
|
93
|
-// $this->addElementAjax('PsyElement 1', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)), $fan_de_psy->getSlug());
|
|
|
94
|
-// $this->addElementAjax('PsyElement 2', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)), $fan_de_psy->getSlug());
|
|
|
95
|
-// $this->addElementAjax('PsyElement 3', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)), $fan_de_psy->getSlug());
|
|
|
96
|
-// $this->addElementAjax('PsyElement 4', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)), $fan_de_psy->getSlug());
|
|
|
97
|
-// $this->addElementAjax('PsyElement 5', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)), $fan_de_psy->getSlug());
|
|
|
98
|
-// $this->addElementAjax('PsyElement 6', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)), $fan_de_psy->getSlug());
|
|
|
99
|
-// $this->addElementAjax('PsyElement 7', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)), $fan_de_psy->getSlug());
|
|
|
100
|
-// $this->addElementAjax('PsyElement 8', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)), $fan_de_psy->getSlug());
|
|
|
101
|
-// $this->addElementAjax('PsyElement 9', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)), $fan_de_psy->getSlug());
|
|
|
102
|
-// $this->addElementAjax('PsyElement 10', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)), $fan_de_psy->getSlug());
|
|
|
103
|
-//
|
|
|
104
|
-// // D'après les fixtures on aura 2 éléments en plus des 10 (paramétre) de la page
|
|
|
105
|
-// // Ouverture de la page profil
|
|
|
106
|
-// $this->crawler = $this->client->request('GET', $this->generateUrl('show_group', array('slug' => $fan_de_psy->getSlug())));
|
|
|
107
|
-// $this->isResponseSuccess();
|
|
|
108
|
-//
|
|
|
109
|
-// $this->exist('span.element_name:contains("PsyElement 10")');
|
|
|
110
|
-// $this->exist('span.element_name:contains("PsyElement 9")');
|
|
|
111
|
-// $this->exist('span.element_name:contains("PsyElement 8")');
|
|
|
112
|
-// $this->exist('span.element_name:contains("PsyElement 7")');
|
|
|
113
|
-// $this->exist('span.element_name:contains("PsyElement 6")');
|
|
|
114
|
-// $this->exist('span.element_name:contains("PsyElement 5")');
|
|
|
115
|
-// $this->exist('span.element_name:contains("PsyElement 4")');
|
|
|
116
|
-// $this->exist('span.element_name:contains("PsyElement 3")');
|
|
|
117
|
-// $this->exist('span.element_name:contains("PsyElement 5")');
|
|
|
118
|
-// $this->exist('span.element_name:contains("PsyElement 1")');
|
|
|
119
|
-// $this->notExist('span.element_name:contains("Infected mushroom - Muse Breaks")');
|
|
|
120
|
-// $this->notExist('span.element_name:contains("Infected Mushroom - Psycho")');
|
|
|
121
|
-//
|
|
|
122
|
-// // L'élément de référence est celui en bas de la liste, donc le premier ajouté
|
|
|
123
|
-// // la haut (vuq ue l'on en a ajouté 10)
|
|
|
124
|
-// $element = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
|
|
|
125
|
-// ->findOneByName('PsyElement 1')
|
|
|
126
|
-// ;
|
|
|
127
|
-// $tags = $this->getDoctrine()->getRepository('MuzichCoreBundle:Group')
|
|
|
128
|
-// ->getElementsTags($fan_de_psy->getId(), $bux->getId())
|
|
|
129
|
-// ;
|
|
|
130
|
-//
|
|
|
131
|
-// $ids = array();
|
|
|
132
|
-// foreach ($tags as $tag)
|
|
|
133
|
-// {
|
|
|
134
|
-// $ids[] = $tag->getId();
|
|
|
135
|
-// }
|
|
|
136
|
-//
|
|
|
137
|
-// // On fait la demande pour en voir plus
|
|
|
138
|
-// $url = $this->generateUrl('show_elements_get', array(
|
|
|
139
|
-// 'type' => 'group',
|
|
|
140
|
-// 'object_id' => $fan_de_psy->getId(),
|
|
|
141
|
-// 'tags_ids_json' => json_encode($ids),
|
|
|
142
|
-// 'id_limit' => $element->getId()
|
|
|
143
|
-// ));
|
|
|
144
|
-// $crawler = $this->client->request(
|
|
|
145
|
-// 'GET',
|
|
|
146
|
-// $url,
|
|
|
147
|
-// array(),
|
|
|
148
|
-// array(),
|
|
|
149
|
-// array('HTTP_X-Requested-With' => 'XMLHttpRequest')
|
|
|
150
|
-// );
|
|
|
151
|
-//
|
|
|
152
|
-// $response = json_decode($this->client->getResponse()->getContent(), true);
|
|
|
153
|
-// $this->assertEquals($response['status'], 'success');
|
|
|
154
|
-// $this->assertTrue(strpos($response['html'], 'Infected mushroom - Muse Breaks') !== false);
|
|
|
155
|
-// $this->assertTrue(strpos($response['html'], 'Infected Mushroom - Psycho') !== false);
|
|
|
156
|
-// }
|
|
|
|
|
12
|
+ public function testViewMoreOnProfile()
|
|
|
13
|
+ {
|
|
|
14
|
+ $this->client = self::createClient();
|
|
|
15
|
+ $this->connectUser('bux', 'toor');
|
|
|
16
|
+
|
|
|
17
|
+ $bux = $this->getUser();
|
|
|
18
|
+
|
|
|
19
|
+ $hardtek_id = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')->findOneByName('Hardtek')->getId();
|
|
|
20
|
+ $tribe_id = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')->findOneByName('Tribe')->getId();
|
|
|
21
|
+
|
|
|
22
|
+ // En premier lieux on va devoir ajouter des éléments.
|
|
|
23
|
+ $this->addElementAjax('PoPElement 1', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)));
|
|
|
24
|
+ $this->addElementAjax('PoPElement 2', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)));
|
|
|
25
|
+ $this->addElementAjax('PoPElement 3', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)));
|
|
|
26
|
+ $this->addElementAjax('PoPElement 4', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)));
|
|
|
27
|
+
|
|
|
28
|
+ // D'après les fixtures on aura 2 éléments en plus des 10 (paramétre) de la page
|
|
|
29
|
+ // Ouverture de la page profil
|
|
|
30
|
+ $this->crawler = $this->client->request('GET', $this->generateUrl('show_user', array('slug' => $bux->getSlug())));
|
|
|
31
|
+ $this->isResponseSuccess();
|
|
|
32
|
+
|
|
|
33
|
+ $this->exist('span.element_name:contains("PoPElement 4")');
|
|
|
34
|
+ $this->exist('span.element_name:contains("PoPElement 3")');
|
|
|
35
|
+ $this->exist('span.element_name:contains("PoPElement 2")');
|
|
|
36
|
+ $this->exist('span.element_name:contains("PoPElement 1")');
|
|
|
37
|
+ $this->exist('span.element_name:contains("Ed Cox - La fanfare des teuffeurs (Hardcordian)")');
|
|
|
38
|
+ $this->exist('span.element_name:contains("Babylon Pression - Des Tasers et des Pauvres")');
|
|
|
39
|
+ $this->exist('span.element_name:contains("AZYD AZYLUM Live au Café Provisoire")');
|
|
|
40
|
+ $this->exist('span.element_name:contains("SOULFLY - Prophecy")');
|
|
|
41
|
+ $this->exist('span.element_name:contains("KoinkOin - H5N1")');
|
|
|
42
|
+ $this->exist('span.element_name:contains("Antropod - Polakatek")');
|
|
|
43
|
+ $this->notExist('span.element_name:contains("Dtc che passdrop")');
|
|
|
44
|
+ $this->notExist('span.element_name:contains("Heretik System Popof - Resistance")');
|
|
|
45
|
+
|
|
|
46
|
+ // L'élément de référence est celui en bas de la liste
|
|
|
47
|
+ $element = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
|
|
|
48
|
+ ->findOneByName('Antropod - Polakatek')
|
|
|
49
|
+ ;
|
|
|
50
|
+ $tags = $this->getDoctrine()->getRepository('MuzichCoreBundle:User')
|
|
|
51
|
+ ->getElementsTags($bux->getId(), $bux->getId())
|
|
|
52
|
+ ;
|
|
|
53
|
+
|
|
|
54
|
+ $ids = array();
|
|
|
55
|
+ foreach ($tags as $tag)
|
|
|
56
|
+ {
|
|
|
57
|
+ $ids[] = $tag->getId();
|
|
|
58
|
+ }
|
|
|
59
|
+
|
|
|
60
|
+ // On fait la demande pour en voir plus
|
|
|
61
|
+ $url = $this->generateUrl('show_elements_get', array(
|
|
|
62
|
+ 'type' => 'user',
|
|
|
63
|
+ 'object_id' => $bux->getId(),
|
|
|
64
|
+ 'tags_ids_json' => json_encode($ids),
|
|
|
65
|
+ 'id_limit' => $element->getId()
|
|
|
66
|
+ ));
|
|
|
67
|
+ $crawler = $this->client->request(
|
|
|
68
|
+ 'GET',
|
|
|
69
|
+ $url,
|
|
|
70
|
+ array(),
|
|
|
71
|
+ array(),
|
|
|
72
|
+ array('HTTP_X-Requested-With' => 'XMLHttpRequest')
|
|
|
73
|
+ );
|
|
|
74
|
+
|
|
|
75
|
+ $response = json_decode($this->client->getResponse()->getContent(), true);
|
|
|
76
|
+ $this->assertEquals($response['status'], 'success');
|
|
|
77
|
+ $this->assertTrue(strpos($response['html'], 'Dtc che passdrop') !== false);
|
|
|
78
|
+ $this->assertTrue(strpos($response['html'], 'Heretik System Popof - Resistance') !== false);
|
|
|
79
|
+ }
|
|
|
80
|
+
|
|
|
81
|
+ public function testViewMoreOnGroup()
|
|
|
82
|
+ {
|
|
|
83
|
+ $this->client = self::createClient();
|
|
|
84
|
+ $this->connectUser('bux', 'toor');
|
|
|
85
|
+
|
|
|
86
|
+ $bux = $this->getUser();
|
|
|
87
|
+ $fan_de_psy = $this->getDoctrine()->getRepository('MuzichCoreBundle:Group')->findOneByName('Fans de psytrance');
|
|
|
88
|
+
|
|
|
89
|
+ $hardtek_id = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')->findOneByName('Hardtek')->getId();
|
|
|
90
|
+ $tribe_id = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')->findOneByName('Tribe')->getId();
|
|
|
91
|
+
|
|
|
92
|
+ // En premier lieux on va devoir ajouter des éléments.
|
|
|
93
|
+ $this->addElementAjax('PsyElement 1', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)), $fan_de_psy->getSlug());
|
|
|
94
|
+ $this->addElementAjax('PsyElement 2', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)), $fan_de_psy->getSlug());
|
|
|
95
|
+ $this->addElementAjax('PsyElement 3', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)), $fan_de_psy->getSlug());
|
|
|
96
|
+ $this->addElementAjax('PsyElement 4', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)), $fan_de_psy->getSlug());
|
|
|
97
|
+ $this->addElementAjax('PsyElement 5', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)), $fan_de_psy->getSlug());
|
|
|
98
|
+ $this->addElementAjax('PsyElement 6', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)), $fan_de_psy->getSlug());
|
|
|
99
|
+ $this->addElementAjax('PsyElement 7', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)), $fan_de_psy->getSlug());
|
|
|
100
|
+ $this->addElementAjax('PsyElement 8', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)), $fan_de_psy->getSlug());
|
|
|
101
|
+ $this->addElementAjax('PsyElement 9', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)), $fan_de_psy->getSlug());
|
|
|
102
|
+ $this->addElementAjax('PsyElement 10', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)), $fan_de_psy->getSlug());
|
|
|
103
|
+
|
|
|
104
|
+ // D'après les fixtures on aura 2 éléments en plus des 10 (paramétre) de la page
|
|
|
105
|
+ // Ouverture de la page profil
|
|
|
106
|
+ $this->crawler = $this->client->request('GET', $this->generateUrl('show_group', array('slug' => $fan_de_psy->getSlug())));
|
|
|
107
|
+ $this->isResponseSuccess();
|
|
|
108
|
+
|
|
|
109
|
+ $this->exist('span.element_name:contains("PsyElement 10")');
|
|
|
110
|
+ $this->exist('span.element_name:contains("PsyElement 9")');
|
|
|
111
|
+ $this->exist('span.element_name:contains("PsyElement 8")');
|
|
|
112
|
+ $this->exist('span.element_name:contains("PsyElement 7")');
|
|
|
113
|
+ $this->exist('span.element_name:contains("PsyElement 6")');
|
|
|
114
|
+ $this->exist('span.element_name:contains("PsyElement 5")');
|
|
|
115
|
+ $this->exist('span.element_name:contains("PsyElement 4")');
|
|
|
116
|
+ $this->exist('span.element_name:contains("PsyElement 3")');
|
|
|
117
|
+ $this->exist('span.element_name:contains("PsyElement 5")');
|
|
|
118
|
+ $this->exist('span.element_name:contains("PsyElement 1")');
|
|
|
119
|
+ $this->notExist('span.element_name:contains("Infected mushroom - Muse Breaks")');
|
|
|
120
|
+ $this->notExist('span.element_name:contains("Infected Mushroom - Psycho")');
|
|
|
121
|
+
|
|
|
122
|
+ // L'élément de référence est celui en bas de la liste, donc le premier ajouté
|
|
|
123
|
+ // la haut (vuq ue l'on en a ajouté 10)
|
|
|
124
|
+ $element = $this->getDoctrine()->getRepository('MuzichCoreBundle:Element')
|
|
|
125
|
+ ->findOneByName('PsyElement 1')
|
|
|
126
|
+ ;
|
|
|
127
|
+ $tags = $this->getDoctrine()->getRepository('MuzichCoreBundle:Group')
|
|
|
128
|
+ ->getElementsTags($fan_de_psy->getId(), $bux->getId())
|
|
|
129
|
+ ;
|
|
|
130
|
+
|
|
|
131
|
+ $ids = array();
|
|
|
132
|
+ foreach ($tags as $tag)
|
|
|
133
|
+ {
|
|
|
134
|
+ $ids[] = $tag->getId();
|
|
|
135
|
+ }
|
|
|
136
|
+
|
|
|
137
|
+ // On fait la demande pour en voir plus
|
|
|
138
|
+ $url = $this->generateUrl('show_elements_get', array(
|
|
|
139
|
+ 'type' => 'group',
|
|
|
140
|
+ 'object_id' => $fan_de_psy->getId(),
|
|
|
141
|
+ 'tags_ids_json' => json_encode($ids),
|
|
|
142
|
+ 'id_limit' => $element->getId()
|
|
|
143
|
+ ));
|
|
|
144
|
+ $crawler = $this->client->request(
|
|
|
145
|
+ 'GET',
|
|
|
146
|
+ $url,
|
|
|
147
|
+ array(),
|
|
|
148
|
+ array(),
|
|
|
149
|
+ array('HTTP_X-Requested-With' => 'XMLHttpRequest')
|
|
|
150
|
+ );
|
|
|
151
|
+
|
|
|
152
|
+ $response = json_decode($this->client->getResponse()->getContent(), true);
|
|
|
153
|
+ $this->assertEquals($response['status'], 'success');
|
|
|
154
|
+ $this->assertTrue(strpos($response['html'], 'Infected mushroom - Muse Breaks') !== false);
|
|
|
155
|
+ $this->assertTrue(strpos($response['html'], 'Infected Mushroom - Psycho') !== false);
|
|
|
156
|
+ }
|
157
|
|
157
|
|
158
|
/**
|
158
|
/**
|
159
|
* Contrôle de l'affichage des informations x partages x suiveur ...
|
159
|
* Contrôle de l'affichage des informations x partages x suiveur ...
|