Merge branch '2015.11' into 2015.11-develop
[tine20] / tests / tine20 / Crm / JsonTest.php
index c8a75ed..e59d8e6 100644 (file)
@@ -87,86 +87,7 @@ class Crm_JsonTest extends Crm_AbstractTest
         parent::tearDown();
         Crm_Controller_Lead::getInstance()->duplicateCheckFields(array('lead_name'));
     }
-     
-    /**
-     * test get crm registry
-     * 
-     * @return void
-     */
-    public function testGetRegistryData()
-    {
-        $registry = $this->_getUit()->getRegistryData();
-        
-        $types = array('leadtypes', 'leadstates', 'leadsources');
-        
-        // check data
-        foreach ($types as $type) {
-            $this->assertGreaterThan(0, $registry[$type]['totalcount']);
-            $this->assertGreaterThan(0, count($registry[$type]['results']));
-        }
-        
-        // check defaults
-        $this->assertEquals(array(
-            'leadstate_id'  => 1,
-            'leadtype_id'   => 1,
-            'leadsource_id' => 1,
-        ), array(
-            'leadstate_id' => $registry['defaults']['leadstate_id'],
-            'leadtype_id' => $registry['defaults']['leadtype_id'],
-            'leadsource_id' => $registry['defaults']['leadsource_id'],
-        ));
-        $this->assertEquals(
-            Tinebase_Container::getInstance()->getDefaultContainer('Crm')->getId(),
-            $registry['defaults']['container_id']['id']
-        );
-    }
-    
-    /**
-     * test get settings/config
-     * 
-     * @return void
-     */
-    public function testGetSettings()
-    {
-        $result = $this->_getUit()->getSettings();
-        
-        $this->assertArrayHasKey('leadstates',  $result);
-        $this->assertArrayHasKey('leadtypes',   $result);
-        $this->assertArrayHasKey('leadsources', $result);
-        $this->assertArrayHasKey('defaults',    $result);
-        $this->assertEquals(6, count($result[Crm_Model_Config::LEADSTATES]));
-        $this->assertEquals(3, count($result[Crm_Model_Config::LEADTYPES]));
-        $this->assertEquals(4, count($result[Crm_Model_Config::LEADSOURCES]));
-    }
-    
-    /**
-     * test get settings/config
-     * 
-     * @return void
-     */
-    public function testSaveSettings()
-    {
-        $oldSettings = $this->_getUit()->getSettings();
-        
-        // change some settings
-        $newSettings = $oldSettings;
-        $newSettings['defaults']['leadstate_id'] = 2;
-        $newSettings['leadsources'][] = array(
-            'id' => 5,
-            'leadsource' => 'Another Leadsource'
-        );
-        $anotherResult = $this->_getUit()->saveSettings($newSettings);
-        $this->assertEquals($newSettings, $anotherResult, 'new settings have not been saved');
-        
-        // reset original settings
-        $result = $this->_getUit()->saveSettings($oldSettings);
-        $this->assertEquals($result, $oldSettings, 'old settings have not been reset');
-        
-        // test Crm_Model_Config::getOptionById
-        $settings = Crm_Controller::getInstance()->getConfigSettings();
-        $this->assertEquals(array(), $settings->getOptionById(5, 'leadsources'), 'Crm_Model_Config::getOptionById failed');
-    }
-    
+
     /**
      * try to add/search/delete a lead with linked contact, task and product
      * 
@@ -414,7 +335,7 @@ class Crm_JsonTest extends Crm_AbstractTest
                 'type'  => 'TASK',
                 'own_model' => 'Tasks_Model_Task',
                 'own_backend' => 'Sql',
-                'own_degree' => 'sibling',
+                'related_degree' => 'sibling',
                 'related_model' => 'Crm_Model_Lead',
                 'related_backend' => 'Sql',
                 'related_id' => $leadData['id'],
@@ -458,7 +379,7 @@ class Crm_JsonTest extends Crm_AbstractTest
                 'type'  => 'TASK',
                 'own_model' => 'Tasks_Model_Task',
                 'own_backend' => 'Sql',
-                'own_degree' => 'sibling',
+                'related_degree' => 'sibling',
                 'related_model' => 'Crm_Model_Lead',
                 'related_backend' => 'Sql',
                 'related_id' => $leadData1['id'],
@@ -473,7 +394,7 @@ class Crm_JsonTest extends Crm_AbstractTest
             'type'  => 'TASK',
             'own_model' => 'Tasks_Model_Task',
             'own_backend' => 'Sql',
-            'own_degree' => 'sibling',
+            'related_degree' => 'sibling',
             'related_model' => 'Crm_Model_Lead',
             'related_backend' => 'Sql',
             'related_id' => $leadData2['id'],
@@ -501,7 +422,7 @@ class Crm_JsonTest extends Crm_AbstractTest
                 'type'  => 'TASK',
                 'own_model' => 'Tasks_Model_Task',
                 'own_backend' => 'Sql',
-                'own_degree' => 'sibling',
+                'related_degree' => 'sibling',
                 'related_model' => 'Crm_Model_Lead',
                 'related_backend' => 'Sql',
                 'related_id' => $leadData1['id'],
@@ -518,7 +439,7 @@ class Crm_JsonTest extends Crm_AbstractTest
                 'type'  => 'TASK',
                 'own_model' => 'Crm_Model_Lead',
                 'own_backend' => 'Sql',
-                'own_degree' => 'sibling',
+                'related_degree' => 'sibling',
                 'related_model' => 'Tasks_Model_Task',
                 'related_backend' => 'Sql',
                 'related_id' => $taskData['id'],