|
@@ -28,35 +28,15 @@ class UserTest extends UnitTest
|
28
|
28
|
|
29
|
29
|
$bux = $this->getUser('bux');
|
30
|
30
|
$original_bux_tags_quick = $bux->getTagsFavoritesQuick();
|
31
|
|
- if ((in_array('Nouveau 1', $bux->getTagsFavoritesQuick())))
|
32
|
|
- {
|
33
|
|
- // hack au cas ou on a éxécuté des tests avant qui on tinjecté le tag
|
34
|
|
- // Nouveau 1
|
35
|
|
- $tags = $bux->getTagsFavoritesQuick();
|
36
|
|
- $this->assertEquals(array(
|
37
|
|
- $tribe->getId() => 'Tribe',
|
38
|
|
- $electro->getId() => 'Electro',
|
39
|
|
- $metal->getId() => 'Metal',
|
40
|
|
- $minimal->getId() => 'Minimal',
|
41
|
|
- $jungle->getId() => 'Jungle',
|
42
|
|
- $hardtek->getId() => 'Hardtek',
|
43
|
|
- array_search('Nouveau 1', $bux->getTagsFavoritesQuick()) => 'Nouveau 1'
|
44
|
|
- ), array_unique($bux->getTagsFavoritesQuick()));
|
45
|
|
- }
|
46
|
|
- else
|
47
|
|
- {
|
48
|
|
- $bux = $this->getUser('bux');
|
49
|
|
- $this->assertEquals(array(
|
50
|
|
- $tribe->getId() => 'Tribe',
|
51
|
|
- $electro->getId() => 'Electro',
|
52
|
|
- $metal->getId() => 'Metal',
|
53
|
|
- $minimal->getId() => 'Minimal',
|
54
|
|
- $jungle->getId() => 'Jungle',
|
55
|
|
- $hardtek->getId() => 'Hardtek'
|
56
|
|
- ), $bux->getTagsFavoritesQuick());
|
57
|
|
- }
|
58
|
|
-
|
59
|
31
|
|
|
32
|
+ $this->assertEquals(array(
|
|
33
|
+ $tribe->getId() => 'Tribe',
|
|
34
|
+ $electro->getId() => 'Electro',
|
|
35
|
+ $metal->getId() => 'Metal',
|
|
36
|
+ $minimal->getId() => 'Minimal',
|
|
37
|
+ $jungle->getId() => 'Jungle',
|
|
38
|
+ $hardtek->getId() => 'Hardtek'
|
|
39
|
+ ), $this->clean_tags($bux->getTagsFavoritesQuick()));
|
60
|
40
|
|
61
|
41
|
$jean = $this->getUser('jean');
|
62
|
42
|
$this->assertEquals(array(
|
|
@@ -79,68 +59,32 @@ class UserTest extends UnitTest
|
79
|
59
|
$this->flush();
|
80
|
60
|
|
81
|
61
|
$bux = $this->getUser('bux');
|
82
|
|
- if ((in_array('Nouveau 1', $bux->getTagsFavoritesQuick())))
|
83
|
|
- {
|
84
|
|
- // hack au cas ou on a éxécuté des tests avant qui on tinjecté le tag
|
85
|
|
- // Nouveau 1
|
86
|
|
- $tags = $bux->getTagsFavoritesQuick();
|
87
|
|
- $this->assertEquals(array(
|
88
|
|
- $tribe->getId() => 'Tribe',
|
89
|
|
- $electro->getId() => 'Electro',
|
90
|
|
- $metal->getId() => 'Metal',
|
91
|
|
- $minimal->getId() => 'Minimal',
|
92
|
|
- $jungle->getId() => 'Jungle',
|
93
|
|
- $hardtek->getId() => 'Hardtek',
|
94
|
|
- array_search('Nouveau 1', $bux->getTagsFavoritesQuick()) => 'Nouveau 1',
|
95
|
|
- $melodiq->getId() => 'Melodique'
|
96
|
|
- ), $bux->getTagsFavoritesQuick());
|
97
|
|
- }
|
98
|
|
- else
|
99
|
|
- {
|
100
|
|
- $bux = $this->getUser('bux');
|
101
|
|
- $this->assertEquals(array(
|
102
|
|
- $tribe->getId() => 'Tribe',
|
103
|
|
- $electro->getId() => 'Electro',
|
104
|
|
- $metal->getId() => 'Metal',
|
105
|
|
- $minimal->getId() => 'Minimal',
|
106
|
|
- $jungle->getId() => 'Jungle',
|
107
|
|
- $hardtek->getId() => 'Hardtek',
|
108
|
|
- $melodiq->getId() => 'Melodique'
|
109
|
|
- ), $bux->getTagsFavoritesQuick());
|
110
|
|
- }
|
|
62
|
+ $this->assertEquals(array(
|
|
63
|
+ $tribe->getId() => 'Tribe',
|
|
64
|
+ $electro->getId() => 'Electro',
|
|
65
|
+ $metal->getId() => 'Metal',
|
|
66
|
+ $minimal->getId() => 'Minimal',
|
|
67
|
+ $jungle->getId() => 'Jungle',
|
|
68
|
+ $hardtek->getId() => 'Hardtek',
|
|
69
|
+ $melodiq->getId() => 'Melodique'
|
|
70
|
+ ), $this->clean_tags($bux->getTagsFavoritesQuick()));
|
111
|
71
|
|
112
|
72
|
$this->getDoctrine()->getManager()->remove($bux_melodique);
|
113
|
73
|
$this->flush();
|
114
|
74
|
|
115
|
75
|
$bux = $this->getUser('bux');
|
116
|
76
|
$original_bux_tags_quick = $bux->getTagsFavoritesQuick();
|
117
|
|
- if ((in_array('Nouveau 1', $bux->getTagsFavoritesQuick())))
|
118
|
|
- {
|
119
|
|
- // hack au cas ou on a éxécuté des tests avant qui on tinjecté le tag
|
120
|
|
- // Nouveau 1
|
121
|
|
- $tags = $bux->getTagsFavoritesQuick();
|
122
|
|
- $this->assertEquals(array(
|
123
|
|
- $tribe->getId() => 'Tribe',
|
124
|
|
- $electro->getId() => 'Electro',
|
125
|
|
- $metal->getId() => 'Metal',
|
126
|
|
- $minimal->getId() => 'Minimal',
|
127
|
|
- $jungle->getId() => 'Jungle',
|
128
|
|
- $hardtek->getId() => 'Hardtek',
|
129
|
|
- array_search('Nouveau 1', $bux->getTagsFavoritesQuick()) => 'Nouveau 1'
|
130
|
|
- ), $bux->getTagsFavoritesQuick());
|
131
|
|
- }
|
132
|
|
- else
|
133
|
|
- {
|
134
|
|
- $bux = $this->getUser('bux');
|
135
|
|
- $this->assertEquals(array(
|
136
|
|
- $tribe->getId() => 'Tribe',
|
137
|
|
- $electro->getId() => 'Electro',
|
138
|
|
- $metal->getId() => 'Metal',
|
139
|
|
- $minimal->getId() => 'Minimal',
|
140
|
|
- $jungle->getId() => 'Jungle',
|
141
|
|
- $hardtek->getId() => 'Hardtek'
|
142
|
|
- ), $bux->getTagsFavoritesQuick());
|
143
|
|
- }
|
|
77
|
+
|
|
78
|
+ $bux = $this->getUser('bux');
|
|
79
|
+ $this->assertEquals(array(
|
|
80
|
+ $tribe->getId() => 'Tribe',
|
|
81
|
+ $electro->getId() => 'Electro',
|
|
82
|
+ $metal->getId() => 'Metal',
|
|
83
|
+ $minimal->getId() => 'Minimal',
|
|
84
|
+ $jungle->getId() => 'Jungle',
|
|
85
|
+ $hardtek->getId() => 'Hardtek'
|
|
86
|
+ ), $this->clean_tags($bux->getTagsFavoritesQuick()));
|
|
87
|
+
|
144
|
88
|
|
145
|
89
|
// Persistance des données de test arf, du coup on remet les tags d'origine
|
146
|
90
|
// a la fin du test au cas ou on le rééxecute
|
|
@@ -148,4 +92,13 @@ class UserTest extends UnitTest
|
148
|
92
|
|
149
|
93
|
}
|
150
|
94
|
|
|
95
|
+ protected function clean_tags($tags)
|
|
96
|
+ {
|
|
97
|
+ while (array_search('Nouveau 1', $tags) !== False)
|
|
98
|
+ {
|
|
99
|
+ unset($tags[array_search('Nouveau 1', $tags)]);
|
|
100
|
+ }
|
|
101
|
+ return $tags;
|
|
102
|
+ }
|
|
103
|
+
|
151
|
104
|
}
|