]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - tests/service/Bug62094Test.php
Release 6.5.13
[Github/sugarcrm.git] / tests / service / Bug62094Test.php
1 <?php
2 /*********************************************************************************
3  * By installing or using this file, you are confirming on behalf of the entity
4  * subscribed to the SugarCRM Inc. product ("Company") that Company is bound by
5  * the SugarCRM Inc. Master Subscription Agreement (“MSA”), which is viewable at:
6  * http://www.sugarcrm.com/master-subscription-agreement
7  *
8  * If Company is not bound by the MSA, then by installing or using this file
9  * you are agreeing unconditionally that Company will be bound by the MSA and
10  * certifying that you have authority to bind Company accordingly.
11  *
12  * Copyright (C) 2004-2013 SugarCRM Inc.  All rights reserved.
13  ********************************************************************************/
14
15
16 require_once 'tests/service/SOAPTestCase.php';
17 require_once 'modules/ModuleBuilder/parsers/relationships/AbstractRelationship.php';
18 require_once 'modules/ModuleBuilder/parsers/relationships/ActivitiesRelationship.php';
19
20 class Bug62094Test extends SOAPTestCase
21 {
22     protected $definition;
23
24     public function setUp()
25     {
26         $this->definition = Array(
27             'id' => 'a3468352-8fd0-ec13-708a-517087f79ada',
28             'relationship_name' => 'accounts_meetings_1',
29             'lhs_module' => 'Accounts',
30             'lhs_table' => 'accounts',
31             'lhs_key' => 'id',
32             'rhs_module' => 'Meetings',
33             'rhs_table' => 'meetings',
34             'rhs_key' => 'id',
35             'join_table' => 'accounts_meetings_1_c',
36             'join_key_lhs' => 'accounts_meetings_1accounts_ida',
37             'join_key_rhs' => 'accounts_meetings_1meetings_idb',
38             'relationship_type' => 'one-to-many',
39             'relationship_role_column' => '',
40             'relationship_role_column_value' =>'',
41             'reverse' => 0,
42             'deleted' => 0,
43             'readonly' => 1,
44             'rhs_subpanel' => '',
45             'lhs_subpanel' => '',
46             'from_studio' => 1,
47             'is_custom' => 1
48         );
49
50         parent::setUp();
51
52     }
53
54     public function tearDown()
55     {
56         parent::tearDown();
57     }
58
59     public function testGetModuleFields()
60     {
61         $relationship = new AbstractRelationship62094($this->definition);
62         $vardef = $relationship->getLinkFieldDefinition('Meetings', 'accounts_meetings_1');
63
64         $this->assertNotEmpty($vardef['module'], 'get_module_fields failed: empty module returned');
65         $this->assertNotEmpty($vardef['bean_name'], 'get_module_fields failed: empty bean_name returned');
66
67         $relationship = new ActivitiesRelationship62094($this->definition);
68         $vardef = $relationship->getLinkFieldDefinition('Meetings', 'accounts_meetings_1');
69
70         $this->assertNotEmpty($vardef['module'], 'get_module_fields failed: empty module returned');
71         $this->assertNotEmpty($vardef['bean_name'], 'get_module_fields failed: empty bean_name returned');
72     }
73 }
74
75 class AbstractRelationship62094 extends AbstractRelationship {
76
77     public function getLinkFieldDefinition ($sourceModule , $relationshipName)
78     {
79         return parent::getLinkFieldDefinition($sourceModule , $relationshipName);
80     }
81
82 }
83
84 class ActivitiesRelationship62094 extends ActivitiesRelationship {
85
86     public function getLinkFieldDefinition ($sourceModule , $relationshipName)
87     {
88         return parent::getLinkFieldDefinition($sourceModule , $relationshipName);
89     }
90
91 }