Browse Source

Tests fonctionels pour "need_tags"

Bastien Sevajol 11 years ago
parent
commit
9f1b03c0fb

File diff suppressed because it is too large
+ 822 - 712
src/Muzich/CoreBundle/Tests/Controller/HomeControllerTest.php


+ 16 - 2
src/Muzich/CoreBundle/lib/FunctionalTest.php View File

@@ -213,8 +213,9 @@ class FunctionalTest extends WebTestCase
213 213
    * @param string $url
214 214
    * @param array $tags
215 215
    * @param string $group_slug 
216
+   * @param boolean $need_tags 
216 217
    */
217
-  protected function procedure_add_element($name, $url, $tags, $group_slug = null)
218
+  protected function procedure_add_element($name, $url, $tags, $group_slug = null, $need_tags = false)
218 219
   {
219 220
     if (!$group_slug)
220 221
     {
@@ -231,7 +232,16 @@ class FunctionalTest extends WebTestCase
231 232
     $form = $this->selectForm('form[action="'.$form_url.'"] input[type="submit"]');
232 233
     $form['element_add[name]'] = $name;
233 234
     $form['element_add[url]'] = $url;
234
-    $form['element_add[tags]'] = json_encode($tags);
235
+    
236
+    if (count($tags))
237
+    {
238
+      $form['element_add[tags]'] = json_encode($tags);
239
+    }
240
+    
241
+    if ($need_tags)
242
+    {
243
+      $form['element_add[need_tags]'] = true;
244
+    }
235 245
     
236 246
     $this->submit($form);
237 247
   }
@@ -519,5 +529,9 @@ class FunctionalTest extends WebTestCase
519 529
       ->findOneBy($params);
520 530
   }
521 531
   
532
+  protected function goToPage($url)
533
+  {
534
+    $this->crawler = $this->client->request('GET', $url);
535
+  }
522 536
   
523 537
 }