Browse Source

blcklist pour le code coverage + Correction d'un bout de code qui se comporte mal en test

bastien 12 years ago
parent
commit
425ea39cde

+ 21 - 3
app/phpunit.xml.dist View File

@@ -27,14 +27,32 @@
27 27
     
28 28
     <filter>
29 29
       <blacklist>
30
+        
31
+        
32
+
33
+
34
+
30 35
         <directory suffix=".php">../src/Acme</directory>
31
-        <exclude>
32
-          <directory suffix=".php">../src/Acme/DemoBundle</directory>
33
-        </exclude>
36
+        
34 37
       </blacklist>
35 38
 
36 39
       <whitelist addUncoveredFilesFromWhitelist="true">
37 40
         <directory suffix=".php">../src/Muzich</directory>
41
+        <exclude>
42
+          <directory suffix=".php">../src/Muzich/CoreBundle/DataFixtures</directory>
43
+
44
+          <directory suffix=".php">../src/Muzich/FavoriteBundle/DependencyInjection</directory>
45
+
46
+          <directory suffix=".php">../src/Muzich/GroupBundle/DependencyInjection</directory>
47
+          <directory suffix=".php">../src/Muzich/GroupBundle/Tests</directory>
48
+
49
+          <directory suffix=".php">../src/Muzich/MynetworkBundle/DependencyInjection</directory>
50
+
51
+          <directory suffix=".php">../src/Muzich/UserBundle/DataFixtures</directory>
52
+          <directory suffix=".php">../src/Muzich/UserBundle/DependencyInjection</directory>
53
+          <directory suffix=".php">../src/Muzich/UserBundle/Tests</directory>
54
+          <directory suffix=".php">../src/Muzich/UserBundle/Entity</directory>
55
+        </exclude>
38 56
       </whitelist>
39 57
     </filter>
40 58
 

+ 1 - 1
src/Muzich/CoreBundle/Tests/Controller/FavoriteControllerTest.php View File

@@ -115,7 +115,7 @@ class FavoriteControllerTest extends FunctionalTest
115 115
     ))).'"]');
116 116
     $link = $this->selectLink('a[href="'.$url.'"]');
117 117
     $this->clickOnLink($link);
118
-    $this->outputDebug();
118
+    
119 119
     $this->isResponseRedirection();
120 120
     $this->followRedirection();
121 121
     $this->isResponseSuccess();

+ 1 - 1
src/Muzich/CoreBundle/Tests/Controller/MynetworkControllerTest.php View File

@@ -57,7 +57,7 @@ class MynetworkControllerTest extends FunctionalTest
57 57
     $form = $this->selectForm('form[action="'.$url.'"] input[type="submit"]');
58 58
     $form['form[string]'] = 'bob';
59 59
     $this->submit($form);
60
-    $this->outputDebug();
60
+    
61 61
     $this->isResponseSuccess();
62 62
     
63 63
     // On trouve bob

+ 12 - 0
src/Muzich/UserBundle/Controller/UserController.php View File

@@ -133,6 +133,18 @@ class UserController extends Controller
133 133
     $request = $this->getRequest();
134 134
     $user = $this->getUser(true, array('join' => array('favorites_tags')));
135 135
     
136
+    /**
137
+     * Bug lors des tests: L'user n'est pas 'lié' a celui en base par doctrine.
138
+     * Docrine le voit si on faire une requete directe.
139
+     */
140
+    if ($this->container->getParameter('env') == 'test')
141
+    {
142
+      $user = $this->getDoctrine()->getRepository('MuzichCoreBundle:User')->findOneById(
143
+        $this->container->get('security.context')->getToken()->getUser()->getId(),
144
+        array()
145
+      )->getSingleResult();
146
+    }
147
+    
136 148
     $form = $this->createForm(
137 149
       new TagFavoritesForm(), 
138 150
       array('tags' => $this->getDoctrine()->getRepository('MuzichCoreBundle:User')