Browse Source

test fix: ElementSearcherTest

bastien 13 years ago
parent
commit
d524dc90e6

+ 1 - 1
src/Muzich/CoreBundle/ElementFactory/ElementManager.php View File

@@ -78,7 +78,7 @@ class ElementManager
78 78
   public function proceedFill(User $owner)
79 79
   {
80 80
     $this->element->setOwner($owner);
81
-    $this->element->setTagsWithIds($this->em, $this->element->getTags());
81
+    $this->element->setTagsWithIds($this->em, json_decode($this->element->getTags()));
82 82
     $this->determineType();
83 83
     $this->proceedExtraFields();
84 84
   }

+ 0 - 1
src/Muzich/CoreBundle/Entity/Element.php View File

@@ -354,7 +354,6 @@ class Element
354 354
   public function setTagsWithIds(EntityManager $em, $ids)
355 355
   {
356 356
     $this->tags = null;
357
-    $ids = json_decode($ids);
358 357
     if (count($ids))
359 358
     {
360 359
       $tags = $em->getRepository('MuzichCoreBundle:Tag')->findByIds($ids)->execute();

+ 13 - 5
src/Muzich/CoreBundle/Tests/Searcher/ElementSearcherTest.php View File

@@ -12,7 +12,7 @@ class ElementSearcherTest extends UnitTest
12 12
     $es = new ElementSearcher();
13 13
     $es->init($ia = array(
14 14
         'network'   => ElementSearcher::NETWORK_PERSONAL, 
15
-        'tags'      => array(1, 2, 6), 
15
+        'tags'      => array(1 => '', 2 => '', 6 => ''), 
16 16
         'count'     => 20, 
17 17
         'user_id'   => 185, 
18 18
         'group_id'  => null, 
@@ -27,7 +27,7 @@ class ElementSearcherTest extends UnitTest
27 27
     $es = new ElementSearcher();
28 28
     $es->init($ia = array(
29 29
         'network'   => ElementSearcher::NETWORK_PERSONAL, 
30
-        'tags'      => array(1, 2, 6), 
30
+        'tags'      => array(1 => '', 2 => '', 6 => ''), 
31 31
         'count'     => 20, 
32 32
         'user_id'   => 185, 
33 33
         'group_id'  => null, 
@@ -35,7 +35,7 @@ class ElementSearcherTest extends UnitTest
35 35
     ));
36 36
     $es->init($ua = array(
37 37
         'network'   => ElementSearcher::NETWORK_PUBLIC, 
38
-        'tags'      => array(5, 8, 123), 
38
+        'tags'      => array(5 => '', 8 => '', 123 => ''), 
39 39
         'count'     => 21, 
40 40
         'user_id'   => 115, 
41 41
         'group_id'  => null, 
@@ -78,7 +78,11 @@ class ElementSearcherTest extends UnitTest
78 78
     $es = new ElementSearcher();
79 79
     $es->init(array(
80 80
       'network'   => ElementSearcher::NETWORK_PUBLIC,
81
-      'tags'      => array($hardtek->getId(), $tribe->getId(), $electro->getId()),
81
+      'tags'      => array(
82
+        $hardtek->getId() => 'Hardtek', 
83
+        $tribe->getId()   => 'Tribe', 
84
+        $electro->getId() => 'Electro'
85
+      ),
82 86
       'count'     => 5
83 87
     ));
84 88
     
@@ -116,7 +120,11 @@ class ElementSearcherTest extends UnitTest
116 120
     $es = new ElementSearcher();
117 121
     $es->init(array(
118 122
       'network'   => ElementSearcher::NETWORK_PERSONAL,
119
-      'tags'      => array($hardtek->getId(), $tribe->getId(), $electro->getId()),
123
+      'tags'      => array(
124
+        $hardtek->getId() => 'Hardtek', 
125
+        $tribe->getId()   => 'Tribe', 
126
+        $electro->getId() => 'Electro'
127
+      ),
120 128
       'count'     => 5
121 129
     ));
122 130