|
@@ -215,4 +215,62 @@ class NoPassTest extends FunctionalTest
|
215
|
215
|
$this->notExist('a.username_update');
|
216
|
216
|
}
|
217
|
217
|
|
|
218
|
+ public function testNoScoringAffections()
|
|
219
|
+ {
|
|
220
|
+ $this->init();
|
|
221
|
+ $this->registerUser('giboulet@mail.com');
|
|
222
|
+ $bux_score = $this->getBuxScore();
|
|
223
|
+ $this->addBuxElementToFavorite();
|
|
224
|
+ $this->followBux();
|
|
225
|
+ $this->assertEquals($bux_score, $this->getBuxScore());
|
|
226
|
+ }
|
|
227
|
+
|
|
228
|
+ protected function getBuxScore()
|
|
229
|
+ {
|
|
230
|
+ return $this->getUser('bux')->getReputation();
|
|
231
|
+ }
|
|
232
|
+
|
|
233
|
+ protected function addBuxElementToFavorite()
|
|
234
|
+ {
|
|
235
|
+ $bux = $this->getUser('bux');
|
|
236
|
+ $element = $this->findOneBy('Element', 'Ed Cox - La fanfare des teuffeurs (Hardcordian)');
|
|
237
|
+ $url = $this->generateUrl('favorite_add', array(
|
|
238
|
+ 'id' => $element->getId(),
|
|
239
|
+ 'token' => $bux->getPersonalHash($element->getId())
|
|
240
|
+ ));
|
|
241
|
+
|
|
242
|
+ $this->client->request(
|
|
243
|
+ 'GET',
|
|
244
|
+ $this->generateUrl('favorite_add', array(
|
|
245
|
+ 'id' => $element->getId(),
|
|
246
|
+ 'token' => $this->getUser()->getPersonalHash($element->getId())
|
|
247
|
+ )), array(), array(), array(
|
|
248
|
+ 'HTTP_X-Requested-With' => 'XMLHttpRequest',
|
|
249
|
+ ));
|
|
250
|
+ $fav = $this->getDoctrine()->getRepository('MuzichCoreBundle:UsersElementsFavorites')
|
|
251
|
+ ->findOneBy(array(
|
|
252
|
+ 'user' => $this->getUser()->getId(),
|
|
253
|
+ 'element' => $element->getId()
|
|
254
|
+ ));
|
|
255
|
+ $this->assertTrue(!is_null($fav));
|
|
256
|
+ }
|
|
257
|
+
|
|
258
|
+ protected function followBux()
|
|
259
|
+ {
|
|
260
|
+ $bux = $this->getUser('bux');
|
|
261
|
+ $this->goToPage($this->generateUrl('follow', array(
|
|
262
|
+ 'type' => 'user',
|
|
263
|
+ 'id' => $bux->getId(),
|
|
264
|
+ 'token' => $this->getUser()->getPersonalHash($bux->getId())
|
|
265
|
+ )));
|
|
266
|
+
|
|
267
|
+ $FollowUser = $this->getDoctrine()->getRepository('MuzichCoreBundle:FollowUser')
|
|
268
|
+ ->findOneBy(array(
|
|
269
|
+ 'follower' => $this->getUser()->getId(),
|
|
270
|
+ 'followed' => $bux->getId()
|
|
271
|
+ ))
|
|
272
|
+ ;
|
|
273
|
+ $this->assertTrue(!is_null($FollowUser));
|
|
274
|
+ }
|
|
275
|
+
|
218
|
276
|
}
|