Przeglądaj źródła

test fix: ElementSearcherTest

bastien 13 lat temu
rodzic
commit
d524dc90e6

+ 1 - 1
src/Muzich/CoreBundle/ElementFactory/ElementManager.php Wyświetl plik

78
   public function proceedFill(User $owner)
78
   public function proceedFill(User $owner)
79
   {
79
   {
80
     $this->element->setOwner($owner);
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
     $this->determineType();
82
     $this->determineType();
83
     $this->proceedExtraFields();
83
     $this->proceedExtraFields();
84
   }
84
   }

+ 0 - 1
src/Muzich/CoreBundle/Entity/Element.php Wyświetl plik

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

+ 13 - 5
src/Muzich/CoreBundle/Tests/Searcher/ElementSearcherTest.php Wyświetl plik

12
     $es = new ElementSearcher();
12
     $es = new ElementSearcher();
13
     $es->init($ia = array(
13
     $es->init($ia = array(
14
         'network'   => ElementSearcher::NETWORK_PERSONAL, 
14
         'network'   => ElementSearcher::NETWORK_PERSONAL, 
15
-        'tags'      => array(1, 2, 6), 
15
+        'tags'      => array(1 => '', 2 => '', 6 => ''), 
16
         'count'     => 20, 
16
         'count'     => 20, 
17
         'user_id'   => 185, 
17
         'user_id'   => 185, 
18
         'group_id'  => null, 
18
         'group_id'  => null, 
27
     $es = new ElementSearcher();
27
     $es = new ElementSearcher();
28
     $es->init($ia = array(
28
     $es->init($ia = array(
29
         'network'   => ElementSearcher::NETWORK_PERSONAL, 
29
         'network'   => ElementSearcher::NETWORK_PERSONAL, 
30
-        'tags'      => array(1, 2, 6), 
30
+        'tags'      => array(1 => '', 2 => '', 6 => ''), 
31
         'count'     => 20, 
31
         'count'     => 20, 
32
         'user_id'   => 185, 
32
         'user_id'   => 185, 
33
         'group_id'  => null, 
33
         'group_id'  => null, 
35
     ));
35
     ));
36
     $es->init($ua = array(
36
     $es->init($ua = array(
37
         'network'   => ElementSearcher::NETWORK_PUBLIC, 
37
         'network'   => ElementSearcher::NETWORK_PUBLIC, 
38
-        'tags'      => array(5, 8, 123), 
38
+        'tags'      => array(5 => '', 8 => '', 123 => ''), 
39
         'count'     => 21, 
39
         'count'     => 21, 
40
         'user_id'   => 115, 
40
         'user_id'   => 115, 
41
         'group_id'  => null, 
41
         'group_id'  => null, 
78
     $es = new ElementSearcher();
78
     $es = new ElementSearcher();
79
     $es->init(array(
79
     $es->init(array(
80
       'network'   => ElementSearcher::NETWORK_PUBLIC,
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
       'count'     => 5
86
       'count'     => 5
83
     ));
87
     ));
84
     
88
     
116
     $es = new ElementSearcher();
120
     $es = new ElementSearcher();
117
     $es->init(array(
121
     $es->init(array(
118
       'network'   => ElementSearcher::NETWORK_PERSONAL,
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
       'count'     => 5
128
       'count'     => 5
121
     ));
129
     ));
122
     
130