|
@@ -73,4 +73,63 @@ class HomeControllerTest extends FunctionalTest
|
73
|
73
|
}
|
74
|
74
|
}
|
75
|
75
|
|
|
76
|
+ /**
|
|
77
|
+ * Test de la présence des elements sur la page d'un utilisateur
|
|
78
|
+ */
|
|
79
|
+ public function testUserPage()
|
|
80
|
+ {
|
|
81
|
+ $this->connectUser('bux', 'toor');
|
|
82
|
+ $jean = $this->getDoctrine()->getRepository('MuzichCoreBundle:User')
|
|
83
|
+ ->findOneByUsername('jean')
|
|
84
|
+ ;
|
|
85
|
+
|
|
86
|
+ $this->crawler = $this->client->request(
|
|
87
|
+ 'GET',
|
|
88
|
+ $this->generateUrl('show_user', array('slug' => $jean->getSlug()))
|
|
89
|
+ );
|
|
90
|
+
|
|
91
|
+ $this->isResponseSuccess();
|
|
92
|
+ $this->exist('h2:contains("'.$jean->getName().'")');
|
|
93
|
+
|
|
94
|
+ $es = new ElementSearcher();
|
|
95
|
+ $es->init(array(
|
|
96
|
+ 'user_id' => $jean->getId()
|
|
97
|
+ ));
|
|
98
|
+
|
|
99
|
+ foreach ($es->getElements($this->getDoctrine(), $this->getUser()->getId()) as $element)
|
|
100
|
+ {
|
|
101
|
+ $this->exist('html:contains("'.$element->getName().'")');
|
|
102
|
+ }
|
|
103
|
+ }
|
|
104
|
+
|
|
105
|
+ /**
|
|
106
|
+ * Test de la présence des elements sur la page d'un utilisateur
|
|
107
|
+ */
|
|
108
|
+ public function testGroupPage()
|
|
109
|
+ {
|
|
110
|
+ $this->connectUser('bux', 'toor');
|
|
111
|
+ $fdp = $this->getDoctrine()->getRepository('MuzichCoreBundle:Group')
|
|
112
|
+ ->findOneBySlug('fans-de-psytrance')
|
|
113
|
+ ->getSingleResult()
|
|
114
|
+ ;
|
|
115
|
+
|
|
116
|
+ $this->crawler = $this->client->request(
|
|
117
|
+ 'GET',
|
|
118
|
+ $this->generateUrl('show_group', array('slug' => $fdp->getSlug()))
|
|
119
|
+ );
|
|
120
|
+
|
|
121
|
+ $this->isResponseSuccess();
|
|
122
|
+ $this->exist('h2:contains("'.$fdp->getName().'")');
|
|
123
|
+
|
|
124
|
+ $es = new ElementSearcher();
|
|
125
|
+ $es->init(array(
|
|
126
|
+ 'group_id' => $fdp->getId()
|
|
127
|
+ ));
|
|
128
|
+
|
|
129
|
+ foreach ($es->getElements($this->getDoctrine(), $this->getUser()->getId()) as $element)
|
|
130
|
+ {
|
|
131
|
+ $this->exist('html:contains("'.$element->getName().'")');
|
|
132
|
+ }
|
|
133
|
+ }
|
|
134
|
+
|
76
|
135
|
}
|