|
@@ -0,0 +1,83 @@
|
|
1
|
+<?php
|
|
2
|
+
|
|
3
|
+namespace Muzich\CoreBundle\Tests\User;
|
|
4
|
+
|
|
5
|
+use Muzich\CoreBundle\lib\UnitTest;
|
|
6
|
+use Muzich\CoreBundle\Entity\UsersTagsFavorites;
|
|
7
|
+
|
|
8
|
+class TagReadTest extends UnitTest
|
|
9
|
+{
|
|
10
|
+
|
|
11
|
+ public function testTagsFavoritesQuick()
|
|
12
|
+ {
|
|
13
|
+ // On vérifie en premier lieu que les donnée en base corresponde bien a
|
|
14
|
+ // ce que l'on veut avoir en fonction des fixtures (c'est une donnée calculé
|
|
15
|
+ // lors de la manipulation de UsersTagsFavorite
|
|
16
|
+
|
|
17
|
+ $tribe = $this->getTag('Tribe');
|
|
18
|
+ $hardtek = $this->getTag('Hardtek');
|
|
19
|
+ $electro = $this->getTag('Electro');
|
|
20
|
+ $metal = $this->getTag('Metal');
|
|
21
|
+ $metalco = $this->getTag('Metalcore');
|
|
22
|
+ $minimal = $this->getTag('Minimal');
|
|
23
|
+ $jungle = $this->getTag('Jungle');
|
|
24
|
+ $melanco = $this->getTag('Melancolique');
|
|
25
|
+ $mellow = $this->getTag('Mellow');
|
|
26
|
+ $melodiq = $this->getTag('Melodique');
|
|
27
|
+
|
|
28
|
+ $bux = $this->getUser('bux');
|
|
29
|
+ $this->assertEquals(array(
|
|
30
|
+ $tribe->getId() => 'Tribe',
|
|
31
|
+ $electro->getId() => 'Electro',
|
|
32
|
+ $metal->getId() => 'Metal',
|
|
33
|
+ $minimal->getId() => 'Minimal',
|
|
34
|
+ $jungle->getId() => 'Jungle',
|
|
35
|
+ $hardtek->getId() => 'Hardtek'
|
|
36
|
+ ), $bux->getTagsFavoritesQuick());
|
|
37
|
+
|
|
38
|
+ $jean = $this->getUser('jean');
|
|
39
|
+ $this->assertEquals(array(
|
|
40
|
+ $melanco->getId() => 'Melancolique',
|
|
41
|
+ $mellow->getId() => 'Mellow',
|
|
42
|
+ $melodiq->getId() => 'Melodique',
|
|
43
|
+ $metal->getId() => 'Metal',
|
|
44
|
+ $metalco->getId() => 'Metalcore',
|
|
45
|
+ $minimal->getId() => 'Minimal'
|
|
46
|
+ ), $jean->getTagsFavoritesQuick());
|
|
47
|
+
|
|
48
|
+ /*
|
|
49
|
+ * Si on effectue des modifs dans les tags favoris
|
|
50
|
+ */
|
|
51
|
+
|
|
52
|
+ $bux_melodique = new UsersTagsFavorites();
|
|
53
|
+ $bux_melodique->setUser($bux);
|
|
54
|
+ $bux_melodique->setTag($melodiq);
|
|
55
|
+ $this->persist($bux_melodique);
|
|
56
|
+ $this->flush();
|
|
57
|
+
|
|
58
|
+ $bux = $this->getUser('bux');
|
|
59
|
+ $this->assertEquals(array(
|
|
60
|
+ $tribe->getId() => 'Tribe',
|
|
61
|
+ $electro->getId() => 'Electro',
|
|
62
|
+ $metal->getId() => 'Metal',
|
|
63
|
+ $minimal->getId() => 'Minimal',
|
|
64
|
+ $jungle->getId() => 'Jungle',
|
|
65
|
+ $hardtek->getId() => 'Hardtek',
|
|
66
|
+ $melodiq->getId() => 'Melodique'
|
|
67
|
+ ), $bux->getTagsFavoritesQuick());
|
|
68
|
+
|
|
69
|
+ $this->getDoctrine()->getEntityManager()->remove($bux_melodique);
|
|
70
|
+ $this->flush();
|
|
71
|
+
|
|
72
|
+ $bux = $this->getUser('bux');
|
|
73
|
+ $this->assertEquals(array(
|
|
74
|
+ $tribe->getId() => 'Tribe',
|
|
75
|
+ $electro->getId() => 'Electro',
|
|
76
|
+ $metal->getId() => 'Metal',
|
|
77
|
+ $minimal->getId() => 'Minimal',
|
|
78
|
+ $jungle->getId() => 'Jungle',
|
|
79
|
+ $hardtek->getId() => 'Hardtek'
|
|
80
|
+ ), $bux->getTagsFavoritesQuick());
|
|
81
|
+ }
|
|
82
|
+
|
|
83
|
+}
|