Browse Source

test fix pour les dernieres modifs.

Sevajol Bastien 12 years ago
parent
commit
c1a359bb0b

+ 8 - 13
src/Muzich/CoreBundle/Tests/Controller/ElementControllerTest.php View File

@@ -302,7 +302,7 @@ class ElementControllerTest extends FunctionalTest
302 302
     ))).'"]');
303 303
   
304 304
     // Suppression de l'élément
305
- 
305
+  
306 306
     // On effectue la demande ajax d'edition
307 307
     $crawler = $this->client->request(
308 308
       'GET', 
@@ -1322,20 +1322,15 @@ class ElementControllerTest extends FunctionalTest
1322 1322
     'name' => 'ZwaNe 01 - Ptit lutin',
1323 1323
     'tags' => array(
1324 1324
       0 => array(
1325
-        'original_name' => 'Basse',
1326
-        'like_found' => false,
1327
-        'like' => array()
1328
-      ),
1329
-      1 => array(
1330
-        'original_name' => 'Batterie',
1325
+        'original_name' => 'Bass guitar',
1331 1326
         'like_found' => true,
1332 1327
         'like' => array(
1333
-          'name' => 'Batterie',
1334
-          'id' => '495',
1335
-          'slug' => 'batterie',
1328
+          'name' => 'Guitare basse',
1329
+          'id' => '724',
1330
+          'slug' => 'guitare basse',
1336 1331
         )
1337 1332
       ),
1338
-      2 => array(
1333
+      1 => array(
1339 1334
         'original_name' => 'Hardtek',
1340 1335
         'like_found' => true,
1341 1336
         'like' => array(
@@ -1344,11 +1339,11 @@ class ElementControllerTest extends FunctionalTest
1344 1339
           'slug' => 'hardtek',
1345 1340
         )
1346 1341
       ),
1347
-      3 => array(
1342
+      2 => array(
1348 1343
         'original_name' => 'Tek',
1349 1344
         'like_found' => false,
1350 1345
         'like' => array()
1351
-      ),
1346
+      )
1352 1347
     ),
1353 1348
     'thumb' => 'http://imgjam.com/albums/s30/30661/covers/1.100.jpg'
1354 1349
     ), $response);

+ 2 - 2
src/Muzich/CoreBundle/Tests/Controller/HomeControllerTest.php View File

@@ -16,7 +16,7 @@ class HomeControllerTest extends FunctionalTest
16 16
   {
17 17
     $this->client = self::createClient();
18 18
     $this->connectUser('bux', 'toor');
19
-
19
+  
20 20
     // Présence du formulaire d'ajout d'un élément
21 21
     $this->exist('form[action="'.($url = $this->generateUrl('element_add')).'"]');
22 22
     $this->exist('form[action="'.$url.'"] input[id="element_add_name"]');
@@ -558,7 +558,7 @@ class HomeControllerTest extends FunctionalTest
558 558
     ;
559 559
     $hardtek_id = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')->findOneByName('Hardtek')->getId();
560 560
     $tribe_id   = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')->findOneByName('Tribe')->getId();
561
-
561
+  
562 562
     // On récupère l'id du dernier element affiché
563 563
     $extract = $this->crawler->filter('ul.elements li.element')
564 564
        ->extract(array('id'));

+ 3 - 2
src/Muzich/CoreBundle/Tests/Controller/ShowControllerTest.php View File

@@ -18,7 +18,7 @@ class ShowControllerTest extends FunctionalTest
18 18
     
19 19
     $hardtek_id = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')->findOneByName('Hardtek')->getId();
20 20
     $tribe_id   = $this->getDoctrine()->getRepository('MuzichCoreBundle:Tag')->findOneByName('Tribe')->getId();
21
-
21
+  
22 22
     // En premier lieux on va devoir ajouter des éléments.
23 23
     $this->addElementAjax('PoPElement 1', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)));
24 24
     $this->addElementAjax('PoPElement 2', 'http://labas.com', json_encode(array($hardtek_id, $tribe_id)));
@@ -148,8 +148,9 @@ class ShowControllerTest extends FunctionalTest
148 148
       array(), 
149 149
       array('HTTP_X-Requested-With' => 'XMLHttpRequest')
150 150
     );
151
-    
151
+   
152 152
     $response = json_decode($this->client->getResponse()->getContent(), true);
153
+    //$this->outputDebug($this->client->getResponse()->getContent());
153 154
     $this->assertEquals($response['status'], 'success');
154 155
     $this->assertTrue(strpos($response['html'], 'Infected mushroom - Muse Breaks') !== false);
155 156
     $this->assertTrue(strpos($response['html'], 'Infected Mushroom - Psycho') !== false);

+ 2 - 2
src/Muzich/CoreBundle/Tests/ElementFactory/ElementFactoryTest.php View File

@@ -442,8 +442,8 @@ class ElementFactoryTest extends UnitTest
442 442
       'data_thumb_url' => 'http://imgjam.com/albums/s30/30661/covers/1.100.jpg',
443 443
       'data_artist' => 'Ptit lutin',
444 444
       'data_tags' => array(
445
-        0 => 'Basse',
446
-        1 => 'Batterie',
445
+        0 => 'Bass guitar',
446
+        1 => 'Drums',
447 447
         2 => 'Hardtek',
448 448
         3 => 'Tek',
449 449
         4 => 'Hardtechno',

+ 9 - 3
src/Muzich/HomeBundle/Controller/ShowController.php View File

@@ -159,13 +159,18 @@ class ShowController extends Controller
159 159
     $viewed_user = null;
160 160
     if ($type == 'user' && $object_id == $this->getUserId())
161 161
     {
162
-      $viewed_user = $this->getUser();
162
+      $object = $viewed_user = $this->getUser();
163 163
     }
164 164
     else if ($type == 'user')
165 165
     {
166
-      $viewed_user = $this->getDoctrine()->getEntityManager()->getRepository('MuzichCoreBundle:User')
166
+      $object = $viewed_user = $this->getDoctrine()->getEntityManager()->getRepository('MuzichCoreBundle:User')
167 167
         ->findOneById($object_id, array())->getSingleResult();
168 168
     }
169
+    else if ($type == 'group')
170
+    {
171
+      $object = $this->getDoctrine()->getEntityManager()->getRepository('MuzichCoreBundle:Group')
172
+        ->findOneById($object_id);
173
+    }
169 174
     
170 175
     $search_object = new ElementSearcher();
171 176
     $tags = null;
@@ -205,7 +210,8 @@ class ShowController extends Controller
205 210
         'user'             => $this->getUser(),
206 211
         'viewed_user'      => $viewed_user,
207 212
         'elements'         => $elements,
208
-        'tag_ids_json'     => $tags_ids_json
213
+        'tag_ids_json'     => $tags_ids_json,
214
+        $type              => $object
209 215
       ))->getContent();
210 216
     }
211 217