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
     ))).'"]');
302
     ))).'"]');
303
   
303
   
304
     // Suppression de l'élément
304
     // Suppression de l'élément
305
- 
305
+  
306
     // On effectue la demande ajax d'edition
306
     // On effectue la demande ajax d'edition
307
     $crawler = $this->client->request(
307
     $crawler = $this->client->request(
308
       'GET', 
308
       'GET', 
1322
     'name' => 'ZwaNe 01 - Ptit lutin',
1322
     'name' => 'ZwaNe 01 - Ptit lutin',
1323
     'tags' => array(
1323
     'tags' => array(
1324
       0 => array(
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
         'like_found' => true,
1326
         'like_found' => true,
1332
         'like' => array(
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
         'original_name' => 'Hardtek',
1334
         'original_name' => 'Hardtek',
1340
         'like_found' => true,
1335
         'like_found' => true,
1341
         'like' => array(
1336
         'like' => array(
1344
           'slug' => 'hardtek',
1339
           'slug' => 'hardtek',
1345
         )
1340
         )
1346
       ),
1341
       ),
1347
-      3 => array(
1342
+      2 => array(
1348
         'original_name' => 'Tek',
1343
         'original_name' => 'Tek',
1349
         'like_found' => false,
1344
         'like_found' => false,
1350
         'like' => array()
1345
         'like' => array()
1351
-      ),
1346
+      )
1352
     ),
1347
     ),
1353
     'thumb' => 'http://imgjam.com/albums/s30/30661/covers/1.100.jpg'
1348
     'thumb' => 'http://imgjam.com/albums/s30/30661/covers/1.100.jpg'
1354
     ), $response);
1349
     ), $response);

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

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

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

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

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

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

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

159
     $viewed_user = null;
159
     $viewed_user = null;
160
     if ($type == 'user' && $object_id == $this->getUserId())
160
     if ($type == 'user' && $object_id == $this->getUserId())
161
     {
161
     {
162
-      $viewed_user = $this->getUser();
162
+      $object = $viewed_user = $this->getUser();
163
     }
163
     }
164
     else if ($type == 'user')
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
         ->findOneById($object_id, array())->getSingleResult();
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
     $search_object = new ElementSearcher();
175
     $search_object = new ElementSearcher();
171
     $tags = null;
176
     $tags = null;
205
         'user'             => $this->getUser(),
210
         'user'             => $this->getUser(),
206
         'viewed_user'      => $viewed_user,
211
         'viewed_user'      => $viewed_user,
207
         'elements'         => $elements,
212
         'elements'         => $elements,
208
-        'tag_ids_json'     => $tags_ids_json
213
+        'tag_ids_json'     => $tags_ids_json,
214
+        $type              => $object
209
       ))->getContent();
215
       ))->getContent();
210
     }
216
     }
211
     
217