test update list with relation
authorStefanie Stamer <s.stamer@metaways.de>
Wed, 24 May 2017 12:55:25 +0000 (14:55 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 1 Jun 2017 12:13:10 +0000 (14:13 +0200)
Change-Id: I8a7c9470c076e44910ddcd9b12951dec2a5f2927
Reviewed-on: http://gerrit.tine20.com/customers/4757
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tests/tine20/Addressbook/JsonTest.php

index 01e276b..402a7bc 100644 (file)
@@ -1923,6 +1923,30 @@ Steuernummer 33/111/32212";
         return $list;
     }
 
+    public function testUpdateListWithRelation()
+    {
+        $list = $this->testCreateListWithMemberAndRole();
+        $relatedList = $this->testCreateListWithMemberAndRole();
+
+        $list['relations'] =  array(
+            array(
+                'type'  => 'LIST',
+                'own_model' => 'Addressbook_Model_List',
+                'own_backend' => 'Sql',
+                'related_degree' => 'sibling',
+                'related_model' => 'Addressbook_Model_List',
+                'related_backend' => 'Sql',
+                'related_id' => $relatedList['id'],
+                'related_record' => $relatedList
+            )
+        );
+        $list = $this->_uit->saveList($list);
+        self::assertEquals(1, count($list['relations']), 'relation missing from list');
+        //Save the list again...
+        $list = $this->_uit->saveList($list);
+        self::assertEquals(1, count($list['relations']), 'relation missing from list');
+    }
+
     public function testSearchListsByMember()
     {
         $list = $this->testCreateListWithMemberAndRole();