@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | //execute the contructor and check for the Object type and attributes |
9 | 9 | $role = new Role(); |
10 | 10 | |
11 | - $this->assertInstanceOf('Role',$role); |
|
12 | - $this->assertInstanceOf('SugarBean',$role); |
|
11 | + $this->assertInstanceOf('Role', $role); |
|
12 | + $this->assertInstanceOf('SugarBean', $role); |
|
13 | 13 | |
14 | 14 | $this->assertAttributeEquals('roles', 'table_name', $role); |
15 | 15 | $this->assertAttributeEquals("roles_modules", 'rel_module_table', $role); |
@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | $role = new Role(); |
29 | 29 | |
30 | 30 | //test without setting name |
31 | - $this->assertEquals(Null,$role->get_summary_text()); |
|
31 | + $this->assertEquals(Null, $role->get_summary_text()); |
|
32 | 32 | |
33 | 33 | //test with name set |
34 | 34 | $role->name = "test"; |
35 | - $this->assertEquals('test',$role->get_summary_text()); |
|
35 | + $this->assertEquals('test', $role->get_summary_text()); |
|
36 | 36 | |
37 | 37 | } |
38 | 38 | |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | |
44 | 44 | //test with empty string params |
45 | 45 | $expected = " SELECT roles.* FROM roles where roles.deleted=0"; |
46 | - $actual = $role->create_export_query('',''); |
|
47 | - $this->assertSame($expected,$actual); |
|
46 | + $actual = $role->create_export_query('', ''); |
|
47 | + $this->assertSame($expected, $actual); |
|
48 | 48 | |
49 | 49 | |
50 | 50 | //test with valid string params |
51 | 51 | $expected = " SELECT roles.* FROM roles where (roles.name = \"\") AND roles.deleted=0"; |
52 | - $actual = $role->create_export_query('roles.id','roles.name = ""'); |
|
53 | - $this->assertSame($expected,$actual); |
|
52 | + $actual = $role->create_export_query('roles.id', 'roles.name = ""'); |
|
53 | + $this->assertSame($expected, $actual); |
|
54 | 54 | |
55 | 55 | } |
56 | 56 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $role = new Role(); |
62 | 62 | |
63 | 63 | $role->id = 1; |
64 | - $mod_ids = array("Accounts","Leads"); |
|
64 | + $mod_ids = array("Accounts", "Leads"); |
|
65 | 65 | |
66 | 66 | |
67 | 67 | //test set_module_relationship. |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $role = new Role(); |
98 | 98 | |
99 | 99 | $role->id = 1; |
100 | - $user_ids = array("1","2"); |
|
100 | + $user_ids = array("1", "2"); |
|
101 | 101 | |
102 | 102 | |
103 | 103 | //create related records |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | { |
159 | 159 | $role = new Role(); |
160 | 160 | |
161 | - $allowed = array("Accounts"=>"Accounts","Leads"=>"Leads",); |
|
162 | - $result = $role->query_user_disallowed_modules($user_id,$allowed); |
|
161 | + $allowed = array("Accounts"=>"Accounts", "Leads"=>"Leads",); |
|
162 | + $result = $role->query_user_disallowed_modules($user_id, $allowed); |
|
163 | 163 | |
164 | 164 | $this->assertTrue(is_array($result)); |
165 | 165 |
@@ -8,9 +8,9 @@ discard block |
||
8 | 8 | { |
9 | 9 | //execute the contructor and check for the Object type and attributes |
10 | 10 | $ical = new iCal(); |
11 | - $this->assertInstanceOf('iCal',$ical); |
|
12 | - $this->assertInstanceOf('vCal',$ical); |
|
13 | - $this->assertInstanceOf('SugarBean',$ical); |
|
11 | + $this->assertInstanceOf('iCal', $ical); |
|
12 | + $this->assertInstanceOf('vCal', $ical); |
|
13 | + $this->assertInstanceOf('SugarBean', $ical); |
|
14 | 14 | |
15 | 15 | } |
16 | 16 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $expectedStart = "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nMETHOD:PUBLISH\r\nX-WR-CALNAME: (SugarCRM)\r\nPRODID:-//SugarCRM//SugarCRM Calendar//EN\r\nBEGIN:VTIMEZONE\r\nTZID:\r\nX-LIC-LOCATION:\r\nEND:VTIMEZONE\r\nCALSCALE:GREGORIAN"; |
26 | 26 | $expectedEnd = "\r\nEND:VCALENDAR\r\n"; |
27 | 27 | |
28 | - $actual = $ical->getVcalIcal($user,6); |
|
28 | + $actual = $ical->getVcalIcal($user, 6); |
|
29 | 29 | |
30 | 30 | //match the leading and trailing string parts to verify it returns expected results |
31 | 31 | $this->assertStringStartsWith($expectedStart, $actual); |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class ACLRoleTest extends PHPUnit_Framework_TestCase{ |
|
3 | +class ACLRoleTest extends PHPUnit_Framework_TestCase { |
|
4 | 4 | |
5 | 5 | |
6 | 6 | |
7 | - public function testACLRole(){ |
|
7 | + public function testACLRole() { |
|
8 | 8 | |
9 | 9 | //execute the contructor and check for the Object type and type attribute |
10 | 10 | $aclRole = new ACLRole(); |
11 | - $this->assertInstanceOf('ACLRole',$aclRole); |
|
12 | - $this->assertInstanceOf('SugarBean',$aclRole); |
|
11 | + $this->assertInstanceOf('ACLRole', $aclRole); |
|
12 | + $this->assertInstanceOf('SugarBean', $aclRole); |
|
13 | 13 | |
14 | 14 | $this->assertAttributeEquals('ACLRoles', 'module_dir', $aclRole); |
15 | 15 | $this->assertAttributeEquals('ACLRole', 'object_name', $aclRole); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | |
25 | - public function testget_summary_text(){ |
|
25 | + public function testget_summary_text() { |
|
26 | 26 | |
27 | 27 | $aclRole = new ACLRole(); |
28 | 28 | |
@@ -30,42 +30,42 @@ discard block |
||
30 | 30 | //it works only if name attribute is preset, throws exception otherwise |
31 | 31 | $aclRole->name = "test role"; |
32 | 32 | $name = $aclRole->get_summary_text(); |
33 | - $this->assertEquals('test role',$name); |
|
33 | + $this->assertEquals('test role', $name); |
|
34 | 34 | |
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | - public function testsetAction(){ |
|
38 | + public function testsetAction() { |
|
39 | 39 | |
40 | 40 | $aclRole = new ACLRole(); |
41 | 41 | |
42 | 42 | //take count of relationship initially and then after method execution and test if relationship count increases |
43 | - $initial_count = count($aclRole->retrieve_relationships('acl_roles_actions', array('role_id'=>'1', 'action_id'=>'1','access_override'=>'90'),'role_id')); |
|
44 | - $aclRole->setAction( '1', '1', '90'); |
|
45 | - $final_count = count($aclRole->retrieve_relationships('acl_roles_actions', array('role_id'=>'1', 'action_id'=>'1','access_override'=>'90'),'role_id')); |
|
43 | + $initial_count = count($aclRole->retrieve_relationships('acl_roles_actions', array('role_id'=>'1', 'action_id'=>'1', 'access_override'=>'90'), 'role_id')); |
|
44 | + $aclRole->setAction('1', '1', '90'); |
|
45 | + $final_count = count($aclRole->retrieve_relationships('acl_roles_actions', array('role_id'=>'1', 'action_id'=>'1', 'access_override'=>'90'), 'role_id')); |
|
46 | 46 | |
47 | - $this->assertGreaterThan($initial_count , $final_count); |
|
47 | + $this->assertGreaterThan($initial_count, $final_count); |
|
48 | 48 | |
49 | 49 | } |
50 | 50 | |
51 | 51 | |
52 | - public function testmark_relationships_deleted(){ |
|
52 | + public function testmark_relationships_deleted() { |
|
53 | 53 | |
54 | 54 | error_reporting(E_ERROR | E_PARSE); |
55 | 55 | |
56 | 56 | $aclRole = new ACLRole(); |
57 | 57 | |
58 | 58 | //take count of relationship initially and then after method execution and test if relationship count decreases |
59 | - $initial_count = count($aclRole->retrieve_relationships('acl_roles_actions', array('role_id'=>'1', 'action_id'=>'1','access_override'=>'90'),'role_id')); |
|
59 | + $initial_count = count($aclRole->retrieve_relationships('acl_roles_actions', array('role_id'=>'1', 'action_id'=>'1', 'access_override'=>'90'), 'role_id')); |
|
60 | 60 | $aclRole->mark_relationships_deleted('1'); |
61 | - $final_count = count($aclRole->retrieve_relationships('acl_roles_actions', array('role_id'=>'1', 'action_id'=>'1','access_override'=>'90'),'role_id')); |
|
61 | + $final_count = count($aclRole->retrieve_relationships('acl_roles_actions', array('role_id'=>'1', 'action_id'=>'1', 'access_override'=>'90'), 'role_id')); |
|
62 | 62 | |
63 | - $this->assertLessThan($initial_count , $final_count); |
|
63 | + $this->assertLessThan($initial_count, $final_count); |
|
64 | 64 | |
65 | 65 | } |
66 | 66 | |
67 | 67 | |
68 | - public function testgetUserRoles(){ |
|
68 | + public function testgetUserRoles() { |
|
69 | 69 | |
70 | 70 | error_reporting(E_ERROR | E_PARSE); |
71 | 71 | |
@@ -76,13 +76,13 @@ discard block |
||
76 | 76 | $this->assertTrue(is_array($result)); |
77 | 77 | |
78 | 78 | //test with flase getAsNameArray param value |
79 | - $result = $aclRole->getUserRoles('1',false); |
|
79 | + $result = $aclRole->getUserRoles('1', false); |
|
80 | 80 | $this->assertTrue(is_array($result)); |
81 | 81 | |
82 | 82 | } |
83 | 83 | |
84 | 84 | |
85 | - public function testgetUserRoleNames(){ |
|
85 | + public function testgetUserRoleNames() { |
|
86 | 86 | |
87 | 87 | $aclRole = new ACLRole(); |
88 | 88 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | |
101 | 101 | |
102 | - public function testgetAllRoles(){ |
|
102 | + public function testgetAllRoles() { |
|
103 | 103 | |
104 | 104 | $aclRole = new ACLRole(); |
105 | 105 | |
@@ -114,32 +114,32 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | |
117 | - public function testgetRoleActions(){ |
|
117 | + public function testgetRoleActions() { |
|
118 | 118 | |
119 | 119 | $aclRole = new ACLRole(); |
120 | 120 | |
121 | 121 | //test with empty value |
122 | 122 | $result = $aclRole->getRoleActions(''); |
123 | 123 | $this->assertTrue(is_array($result)); |
124 | - $this->assertEquals(51,count($result)); |
|
124 | + $this->assertEquals(51, count($result)); |
|
125 | 125 | |
126 | 126 | |
127 | 127 | //test with non empty but non existing role id value, initially no roles exist. |
128 | 128 | $result = $aclRole->getRoleActions('1'); |
129 | 129 | $this->assertTrue(is_array($result)); |
130 | - $this->assertEquals(51,count($result)); |
|
130 | + $this->assertEquals(51, count($result)); |
|
131 | 131 | |
132 | 132 | } |
133 | 133 | |
134 | 134 | |
135 | - public function testtoArray(){ |
|
135 | + public function testtoArray() { |
|
136 | 136 | |
137 | 137 | $aclRole = new ACLRole(); |
138 | 138 | |
139 | 139 | //wihout any fields set |
140 | - $expected = Array("id"=> "", "name"=> "", "description"=> ""); |
|
140 | + $expected = Array("id"=> "", "name"=> "", "description"=> ""); |
|
141 | 141 | $actual = $aclRole->toArray(); |
142 | - $this->assertSame($expected,$actual); |
|
142 | + $this->assertSame($expected, $actual); |
|
143 | 143 | |
144 | 144 | |
145 | 145 | //with fileds pre populated |
@@ -147,23 +147,23 @@ discard block |
||
147 | 147 | $aclRole->name = "test"; |
148 | 148 | $aclRole->description = "some description text"; |
149 | 149 | |
150 | - $expected = Array("id"=> "1", "name"=> "test", "description"=> "some description text"); |
|
150 | + $expected = Array("id"=> "1", "name"=> "test", "description"=> "some description text"); |
|
151 | 151 | $actual = $aclRole->toArray(); |
152 | - $this->assertSame($expected,$actual); |
|
152 | + $this->assertSame($expected, $actual); |
|
153 | 153 | |
154 | 154 | } |
155 | 155 | |
156 | - public function testfromArray(){ |
|
156 | + public function testfromArray() { |
|
157 | 157 | |
158 | 158 | $aclRole = new ACLRole(); |
159 | 159 | |
160 | - $arr = Array("id"=> "1", "name"=> "test", "description"=> "some description text"); |
|
160 | + $arr = Array("id"=> "1", "name"=> "test", "description"=> "some description text"); |
|
161 | 161 | $aclRole->fromArray($arr); |
162 | 162 | |
163 | 163 | //verify that it sets the object attributes correctly |
164 | - $this->assertSame($aclRole->id,"1"); |
|
165 | - $this->assertSame($aclRole->name,"test"); |
|
166 | - $this->assertSame($aclRole->description,"some description text"); |
|
164 | + $this->assertSame($aclRole->id, "1"); |
|
165 | + $this->assertSame($aclRole->name, "test"); |
|
166 | + $this->assertSame($aclRole->description, "some description text"); |
|
167 | 167 | |
168 | 168 | } |
169 | 169 |
@@ -6,9 +6,9 @@ discard block |
||
6 | 6 | |
7 | 7 | //execute the contructor and check for the Object type and attributes |
8 | 8 | $contact = new Contact(); |
9 | - $this->assertInstanceOf('Contact',$contact); |
|
10 | - $this->assertInstanceOf('Person',$contact); |
|
11 | - $this->assertInstanceOf('SugarBean',$contact); |
|
9 | + $this->assertInstanceOf('Contact', $contact); |
|
10 | + $this->assertInstanceOf('Person', $contact); |
|
11 | + $this->assertInstanceOf('SugarBean', $contact); |
|
12 | 12 | |
13 | 13 | $this->assertAttributeEquals('Contacts', 'module_dir', $contact); |
14 | 14 | $this->assertAttributeEquals('Contact', 'object_name', $contact); |
@@ -29,21 +29,21 @@ discard block |
||
29 | 29 | //test with empty strings |
30 | 30 | $query = ""; |
31 | 31 | $contact->add_list_count_joins($query, ''); |
32 | - $this->assertEquals("",$query); |
|
32 | + $this->assertEquals("", $query); |
|
33 | 33 | |
34 | 34 | |
35 | 35 | //test with valid string |
36 | 36 | $query = ""; |
37 | 37 | $expected = "\n LEFT JOIN accounts_contacts\n ON contacts.id=accounts_contacts.contact_id\n LEFT JOIN accounts\n ON accounts_contacts.account_id=accounts.id\n "; |
38 | 38 | $contact->add_list_count_joins($query, 'accounts.name'); |
39 | - $this->assertSame($expected,$query); |
|
39 | + $this->assertSame($expected, $query); |
|
40 | 40 | |
41 | 41 | |
42 | 42 | //test with valid string |
43 | 43 | $query = ""; |
44 | 44 | $expected = "\n LEFT JOIN accounts_contacts\n ON contacts.id=accounts_contacts.contact_id\n LEFT JOIN accounts\n ON accounts_contacts.account_id=accounts.id\n "; |
45 | 45 | $contact->add_list_count_joins($query, 'contacts.name'); |
46 | - $this->assertSame("",$query); |
|
46 | + $this->assertSame("", $query); |
|
47 | 47 | |
48 | 48 | |
49 | 49 | } |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | { |
53 | 53 | $contact = new Contact(); |
54 | 54 | |
55 | - $expected = array( "MAIN"=>"a", "ACCOUNT"=>"a"); |
|
55 | + $expected = array("MAIN"=>"a", "ACCOUNT"=>"a"); |
|
56 | 56 | $actual = $contact->listviewACLHelper(); |
57 | - $this->assertSame($expected,$actual); |
|
57 | + $this->assertSame($expected, $actual); |
|
58 | 58 | |
59 | 59 | } |
60 | 60 | |
@@ -63,15 +63,15 @@ discard block |
||
63 | 63 | $contact = new Contact(); |
64 | 64 | |
65 | 65 | //test without request action parameter |
66 | - $expected =" SELECT contacts.* , ' ' opportunity_role_fields , ' ' opportunity_id , ' ' c_accept_status_fields , ' ' call_id , ' ' e_invite_status_fields , ' ' fp_events_contactsfp_events_ida , ' ' e_accept_status_fields , LTRIM(RTRIM(CONCAT(IFNULL(contacts.first_name,''),' ',IFNULL(contacts.last_name,'')))) as name , jt4.user_name modified_by_name , jt4.created_by modified_by_name_owner , 'Users' modified_by_name_mod , jt5.user_name created_by_name , jt5.created_by created_by_name_owner , 'Users' created_by_name_mod , jt6.user_name assigned_user_name , jt6.created_by assigned_user_name_owner , 'Users' assigned_user_name_mod, LTRIM(RTRIM(CONCAT(IFNULL(contacts.first_name,''),' ',IFNULL(contacts.last_name,'')))) as full_name, ' ' account_name , ' ' account_id , jt8.last_name report_to_name , jt8.assigned_user_id report_to_name_owner , 'Contacts' report_to_name_mod , jt9.name campaign_name , jt9.assigned_user_id campaign_name_owner , 'Campaigns' campaign_name_mod, ' ' m_accept_status_fields , ' ' meeting_id FROM contacts LEFT JOIN users jt4 ON contacts.modified_user_id=jt4.id AND jt4.deleted=0\n\n AND jt4.deleted=0 LEFT JOIN users jt5 ON contacts.created_by=jt5.id AND jt5.deleted=0\n\n AND jt5.deleted=0 LEFT JOIN users jt6 ON contacts.assigned_user_id=jt6.id AND jt6.deleted=0\n\n AND jt6.deleted=0 LEFT JOIN contacts jt8 ON contacts.reports_to_id=jt8.id AND jt8.deleted=0\n\n AND jt8.deleted=0 LEFT JOIN campaigns jt9 ON contacts.campaign_id=jt9.id AND jt9.deleted=0\n\n AND jt9.deleted=0 where (account.name is null) AND contacts.deleted=0"; |
|
67 | - $actual = $contact->create_new_list_query("account.name","account.name is null"); |
|
68 | - $this->assertSame($expected,$actual); |
|
66 | + $expected = " SELECT contacts.* , ' ' opportunity_role_fields , ' ' opportunity_id , ' ' c_accept_status_fields , ' ' call_id , ' ' e_invite_status_fields , ' ' fp_events_contactsfp_events_ida , ' ' e_accept_status_fields , LTRIM(RTRIM(CONCAT(IFNULL(contacts.first_name,''),' ',IFNULL(contacts.last_name,'')))) as name , jt4.user_name modified_by_name , jt4.created_by modified_by_name_owner , 'Users' modified_by_name_mod , jt5.user_name created_by_name , jt5.created_by created_by_name_owner , 'Users' created_by_name_mod , jt6.user_name assigned_user_name , jt6.created_by assigned_user_name_owner , 'Users' assigned_user_name_mod, LTRIM(RTRIM(CONCAT(IFNULL(contacts.first_name,''),' ',IFNULL(contacts.last_name,'')))) as full_name, ' ' account_name , ' ' account_id , jt8.last_name report_to_name , jt8.assigned_user_id report_to_name_owner , 'Contacts' report_to_name_mod , jt9.name campaign_name , jt9.assigned_user_id campaign_name_owner , 'Campaigns' campaign_name_mod, ' ' m_accept_status_fields , ' ' meeting_id FROM contacts LEFT JOIN users jt4 ON contacts.modified_user_id=jt4.id AND jt4.deleted=0\n\n AND jt4.deleted=0 LEFT JOIN users jt5 ON contacts.created_by=jt5.id AND jt5.deleted=0\n\n AND jt5.deleted=0 LEFT JOIN users jt6 ON contacts.assigned_user_id=jt6.id AND jt6.deleted=0\n\n AND jt6.deleted=0 LEFT JOIN contacts jt8 ON contacts.reports_to_id=jt8.id AND jt8.deleted=0\n\n AND jt8.deleted=0 LEFT JOIN campaigns jt9 ON contacts.campaign_id=jt9.id AND jt9.deleted=0\n\n AND jt9.deleted=0 where (account.name is null) AND contacts.deleted=0"; |
|
67 | + $actual = $contact->create_new_list_query("account.name", "account.name is null"); |
|
68 | + $this->assertSame($expected, $actual); |
|
69 | 69 | |
70 | 70 | //test with request action parameter = ContactAddressPopup |
71 | 71 | $_REQUEST['action'] = 'ContactAddressPopup'; |
72 | 72 | $expected = "SELECT LTRIM(RTRIM(CONCAT(IFNULL(contacts.first_name,''),'',IFNULL(contacts.last_name,'')))) name, \n contacts.*,\n accounts.name as account_name,\n accounts.id as account_id,\n accounts.assigned_user_id account_id_owner,\n users.user_name as assigned_user_name \n FROM contacts LEFT JOIN users\n ON contacts.assigned_user_id=users.id\n LEFT JOIN accounts_contacts\n ON contacts.id=accounts_contacts.contact_id and accounts_contacts.deleted = 0\n LEFT JOIN accounts\n ON accounts_contacts.account_id=accounts.id AND accounts.deleted=0 LEFT JOIN email_addr_bean_rel eabl ON eabl.bean_id = contacts.id AND eabl.bean_module = 'Contacts' and eabl.primary_address = 1 and eabl.deleted=0 LEFT JOIN email_addresses ea ON (ea.id = eabl.email_address_id) where (account.name is null) AND contacts.deleted=0 "; |
73 | - $actual = $contact->create_new_list_query("account.name","account.name is null"); |
|
74 | - $this->assertSame($expected,$actual); |
|
73 | + $actual = $contact->create_new_list_query("account.name", "account.name is null"); |
|
74 | + $this->assertSame($expected, $actual); |
|
75 | 75 | |
76 | 76 | } |
77 | 77 | |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | |
84 | 84 | //test with empty string params |
85 | 85 | $expected = "SELECT LTRIM(RTRIM(CONCAT(IFNULL(contacts.first_name,''),'',IFNULL(contacts.last_name,'')))) name, \n contacts.*,\n accounts.name as account_name,\n accounts.id as account_id,\n accounts.assigned_user_id account_id_owner,\n users.user_name as assigned_user_name \n FROM contacts LEFT JOIN users\n ON contacts.assigned_user_id=users.id\n LEFT JOIN accounts_contacts\n ON contacts.id=accounts_contacts.contact_id and accounts_contacts.deleted = 0\n LEFT JOIN accounts\n ON accounts_contacts.account_id=accounts.id AND accounts.deleted=0 LEFT JOIN email_addr_bean_rel eabl ON eabl.bean_id = contacts.id AND eabl.bean_module = 'Contacts' and eabl.primary_address = 1 and eabl.deleted=0 LEFT JOIN email_addresses ea ON (ea.id = eabl.email_address_id) where contacts.deleted=0 "; |
86 | - $actual = $contact->address_popup_create_new_list_query('',''); |
|
87 | - $this->assertSame($expected,$actual); |
|
86 | + $actual = $contact->address_popup_create_new_list_query('', ''); |
|
87 | + $this->assertSame($expected, $actual); |
|
88 | 88 | |
89 | 89 | |
90 | 90 | //test with valid string params |
91 | 91 | $expected = "SELECT LTRIM(RTRIM(CONCAT(IFNULL(contacts.first_name,''),'',IFNULL(contacts.last_name,'')))) name, \n contacts.*,\n accounts.name as account_name,\n accounts.id as account_id,\n accounts.assigned_user_id account_id_owner,\n users.user_name as assigned_user_name \n FROM contacts LEFT JOIN users\n ON contacts.assigned_user_id=users.id\n LEFT JOIN accounts_contacts\n ON contacts.id=accounts_contacts.contact_id and accounts_contacts.deleted = 0\n LEFT JOIN accounts\n ON accounts_contacts.account_id=accounts.id AND accounts.deleted=0 LEFT JOIN email_addr_bean_rel eabl ON eabl.bean_id = contacts.id AND eabl.bean_module = 'Contacts' and eabl.primary_address = 1 and eabl.deleted=0 LEFT JOIN email_addresses ea ON (ea.id = eabl.email_address_id) where (contacts.name=\"\") AND contacts.deleted=0 "; |
92 | - $actual = $contact->address_popup_create_new_list_query('contacts.id','contacts.name=""'); |
|
93 | - $this->assertSame($expected,$actual); |
|
92 | + $actual = $contact->address_popup_create_new_list_query('contacts.id', 'contacts.name=""'); |
|
93 | + $this->assertSame($expected, $actual); |
|
94 | 94 | |
95 | 95 | } |
96 | 96 | |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | |
101 | 101 | //test with empty string params |
102 | 102 | $expected = "SELECT\n contacts.*,\n email_addresses.email_address email_address,\n '' email_addresses_non_primary, accounts.name as account_name,\n users.user_name as assigned_user_name FROM contacts LEFT JOIN users\n ON contacts.assigned_user_id=users.id LEFT JOIN accounts_contacts\n ON ( contacts.id=accounts_contacts.contact_id and (accounts_contacts.deleted is null or accounts_contacts.deleted = 0))\n LEFT JOIN accounts\n ON accounts_contacts.account_id=accounts.id LEFT JOIN email_addr_bean_rel on contacts.id = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module='Contacts' and email_addr_bean_rel.deleted=0 and email_addr_bean_rel.primary_address=1 LEFT JOIN email_addresses on email_addresses.id = email_addr_bean_rel.email_address_id where ( accounts.deleted IS NULL OR accounts.deleted=0 )\n AND contacts.deleted=0 "; |
103 | - $actual = $contact->create_export_query('',''); |
|
104 | - $this->assertSame($expected,$actual); |
|
103 | + $actual = $contact->create_export_query('', ''); |
|
104 | + $this->assertSame($expected, $actual); |
|
105 | 105 | |
106 | 106 | |
107 | 107 | //test with valid string params |
108 | 108 | $expected = "SELECT\n contacts.*,\n email_addresses.email_address email_address,\n '' email_addresses_non_primary, accounts.name as account_name,\n users.user_name as assigned_user_name FROM contacts LEFT JOIN users\n ON contacts.assigned_user_id=users.id LEFT JOIN accounts_contacts\n ON ( contacts.id=accounts_contacts.contact_id and (accounts_contacts.deleted is null or accounts_contacts.deleted = 0))\n LEFT JOIN accounts\n ON accounts_contacts.account_id=accounts.id LEFT JOIN email_addr_bean_rel on contacts.id = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module='Contacts' and email_addr_bean_rel.deleted=0 and email_addr_bean_rel.primary_address=1 LEFT JOIN email_addresses on email_addresses.id = email_addr_bean_rel.email_address_id where (contacts.name=\"\") AND ( accounts.deleted IS NULL OR accounts.deleted=0 )\n AND contacts.deleted=0 "; |
109 | - $actual = $contact->create_export_query('contacts.id','contacts.name=""'); |
|
110 | - $this->assertSame($expected,$actual); |
|
109 | + $actual = $contact->create_export_query('contacts.id', 'contacts.name=""'); |
|
110 | + $this->assertSame($expected, $actual); |
|
111 | 111 | |
112 | 112 | } |
113 | 113 | |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | |
125 | 125 | $contact->fill_in_additional_list_fields(); |
126 | 126 | |
127 | - $this->assertEquals("firstn lastn",$contact->full_name); |
|
128 | - $this->assertEquals("firstn lastn <[email protected]>",$contact->email_and_name1); |
|
129 | - $this->assertEquals("firstn lastn <[email protected]>",$contact->email_and_name2); |
|
127 | + $this->assertEquals("firstn lastn", $contact->full_name); |
|
128 | + $this->assertEquals("firstn lastn <[email protected]>", $contact->email_and_name1); |
|
129 | + $this->assertEquals("firstn lastn <[email protected]>", $contact->email_and_name2); |
|
130 | 130 | |
131 | 131 | } |
132 | 132 | |
@@ -139,14 +139,14 @@ discard block |
||
139 | 139 | |
140 | 140 | $contact->fill_in_additional_detail_fields(); |
141 | 141 | |
142 | - $this->assertEquals("",$contact->account_name); |
|
143 | - $this->assertEquals("",$contact->account_id); |
|
144 | - $this->assertEquals("",$contact->report_to_name); |
|
142 | + $this->assertEquals("", $contact->account_name); |
|
143 | + $this->assertEquals("", $contact->account_id); |
|
144 | + $this->assertEquals("", $contact->report_to_name); |
|
145 | 145 | |
146 | 146 | } |
147 | 147 | |
148 | 148 | |
149 | - public function testload_contacts_users_relationship(){ |
|
149 | + public function testload_contacts_users_relationship() { |
|
150 | 150 | |
151 | 151 | $contact = new Contact(); |
152 | 152 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $contact->first_name = "first"; |
170 | 170 | $contact->last_name = "last"; |
171 | 171 | |
172 | - $expected = array ( |
|
172 | + $expected = array( |
|
173 | 173 | 'NAME' => 'first last', |
174 | 174 | 'DELETED' => 0, |
175 | 175 | 'FIRST_NAME' => 'first', |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | } |
196 | 196 | |
197 | 197 | |
198 | - public function testbuild_generic_where_clause () |
|
198 | + public function testbuild_generic_where_clause() |
|
199 | 199 | { |
200 | 200 | |
201 | 201 | $contact = new Contact(); |
@@ -203,13 +203,13 @@ discard block |
||
203 | 203 | //test with string |
204 | 204 | $expected = "contacts.last_name like 'test%' or contacts.first_name like 'test%' or accounts.name like 'test%' or contacts.assistant like 'test%' or ea.email_address like 'test%'"; |
205 | 205 | $actual = $contact->build_generic_where_clause('test'); |
206 | - $this->assertSame($expected,$actual); |
|
206 | + $this->assertSame($expected, $actual); |
|
207 | 207 | |
208 | 208 | |
209 | 209 | //test with number |
210 | 210 | $expected = "contacts.last_name like '1%' or contacts.first_name like '1%' or accounts.name like '1%' or contacts.assistant like '1%' or ea.email_address like '1%' or contacts.phone_home like '%1%' or contacts.phone_mobile like '%1%' or contacts.phone_work like '%1%' or contacts.phone_other like '%1%' or contacts.phone_fax like '%1%' or contacts.assistant_phone like '%1%'"; |
211 | 211 | $actual = $contact->build_generic_where_clause(1); |
212 | - $this->assertSame($expected,$actual); |
|
212 | + $this->assertSame($expected, $actual); |
|
213 | 213 | |
214 | 214 | } |
215 | 215 | |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | |
226 | 226 | $result = $contact->set_notification_body(new Sugar_Smarty(), $contact); |
227 | 227 | |
228 | - $this->assertEquals($contact->full_name ,$result->_tpl_vars['CONTACT_NAME']); |
|
229 | - $this->assertEquals($contact->description ,$result->_tpl_vars['CONTACT_DESCRIPTION']); |
|
228 | + $this->assertEquals($contact->full_name, $result->_tpl_vars['CONTACT_NAME']); |
|
229 | + $this->assertEquals($contact->description, $result->_tpl_vars['CONTACT_DESCRIPTION']); |
|
230 | 230 | |
231 | 231 | } |
232 | 232 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $contact = new Contact(); |
236 | 236 | |
237 | 237 | $result = $contact->get_contact_id_by_email(""); |
238 | - $this->assertEquals(null,$result); |
|
238 | + $this->assertEquals(null, $result); |
|
239 | 239 | |
240 | 240 | |
241 | 241 | //$result = $contact->get_contact_id_by_email("[email protected]"); |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | //execute the method and verify that it retunrs expected results |
277 | 277 | $expected = "SELECT emails.id FROM emails JOIN (select DISTINCT email_id from emails_email_addr_rel eear\n\n join email_addr_bean_rel eabr on eabr.bean_id ='' and eabr.bean_module = 'Contacts' and\n eabr.email_address_id = eear.email_address_id and eabr.deleted=0\n where eear.deleted=0 and eear.email_id not in\n (select eb.email_id from emails_beans eb where eb.bean_module ='Contacts' and eb.bean_id = '')\n ) derivedemails on derivedemails.email_id = emails.id"; |
278 | 278 | $actual = $contact->get_unlinked_email_query(); |
279 | - $this->assertSame($expected,$actual); |
|
279 | + $this->assertSame($expected, $actual); |
|
280 | 280 | |
281 | 281 | } |
282 | 282 |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class AOW_ConditionTest extends PHPUnit_Framework_TestCase { |
|
3 | +class AOW_ConditionTest extends PHPUnit_Framework_TestCase { |
|
4 | 4 | |
5 | 5 | |
6 | - public function testAOW_Condition(){ |
|
6 | + public function testAOW_Condition() { |
|
7 | 7 | |
8 | 8 | //execute the contructor and check for the Object type and attributes |
9 | 9 | $aowCondition = new AOW_Condition(); |
10 | - $this->assertInstanceOf('AOW_Condition',$aowCondition); |
|
11 | - $this->assertInstanceOf('Basic',$aowCondition); |
|
12 | - $this->assertInstanceOf('SugarBean',$aowCondition); |
|
10 | + $this->assertInstanceOf('AOW_Condition', $aowCondition); |
|
11 | + $this->assertInstanceOf('Basic', $aowCondition); |
|
12 | + $this->assertInstanceOf('SugarBean', $aowCondition); |
|
13 | 13 | |
14 | 14 | $this->assertAttributeEquals('AOW_Conditions', 'module_dir', $aowCondition); |
15 | 15 | $this->assertAttributeEquals('AOW_Condition', 'object_name', $aowCondition); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | } |
24 | 24 | |
25 | - public function testbean_implements(){ |
|
25 | + public function testbean_implements() { |
|
26 | 26 | |
27 | 27 | error_reporting(E_ERROR | E_PARSE); |
28 | 28 | |
@@ -33,17 +33,17 @@ discard block |
||
33 | 33 | |
34 | 34 | } |
35 | 35 | |
36 | - public function testsave_lines(){ |
|
36 | + public function testsave_lines() { |
|
37 | 37 | |
38 | 38 | $aowCondition = new AOW_Condition(); |
39 | 39 | |
40 | 40 | //populate required values |
41 | - $post_data= Array(); |
|
42 | - $post_data["name"] = Array('test1','test2'); |
|
43 | - $post_data["field"] = Array('field1','field2'); |
|
44 | - $post_data["operator"] = Array('=','!='); |
|
45 | - $post_data["value_type"] = Array('int','string'); |
|
46 | - $post_data["value"] = Array('1','abc'); |
|
41 | + $post_data = Array(); |
|
42 | + $post_data["name"] = Array('test1', 'test2'); |
|
43 | + $post_data["field"] = Array('field1', 'field2'); |
|
44 | + $post_data["operator"] = Array('=', '!='); |
|
45 | + $post_data["value_type"] = Array('int', 'string'); |
|
46 | + $post_data["value"] = Array('1', 'abc'); |
|
47 | 47 | |
48 | 48 | |
49 | 49 | //create parent bean |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | |
57 | 57 | //get the linked beans and verify if records created |
58 | 58 | $aow_conditions = $aowWorkFlow->get_linked_beans('aow_conditions', $aowWorkFlow->object_name); |
59 | - $this->assertEquals(count($post_data["field"]), count($aow_conditions) ); |
|
59 | + $this->assertEquals(count($post_data["field"]), count($aow_conditions)); |
|
60 | 60 | |
61 | 61 | |
62 | 62 | //cleanup afterwards |
63 | - foreach($aow_conditions as $lineItem){ |
|
63 | + foreach ($aow_conditions as $lineItem) { |
|
64 | 64 | $lineItem->mark_deleted($lineItem->id); |
65 | 65 | } |
66 | 66 |
@@ -2,13 +2,13 @@ |
||
2 | 2 | |
3 | 3 | class AOP_Case_EventsTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | - public function testAOP_Case_Events(){ |
|
5 | + public function testAOP_Case_Events() { |
|
6 | 6 | |
7 | 7 | //execute the contructor and check for the Object type and type attribute |
8 | 8 | $aopCaseEvents = new AOP_Case_Events(); |
9 | - $this->assertInstanceOf('AOP_Case_Events',$aopCaseEvents); |
|
10 | - $this->assertInstanceOf('Basic',$aopCaseEvents); |
|
11 | - $this->assertInstanceOf('SugarBean',$aopCaseEvents); |
|
9 | + $this->assertInstanceOf('AOP_Case_Events', $aopCaseEvents); |
|
10 | + $this->assertInstanceOf('Basic', $aopCaseEvents); |
|
11 | + $this->assertInstanceOf('SugarBean', $aopCaseEvents); |
|
12 | 12 | |
13 | 13 | $this->assertAttributeEquals('AOP_Case_Events', 'module_dir', $aopCaseEvents); |
14 | 14 | $this->assertAttributeEquals('AOP_Case_Events', 'object_name', $aopCaseEvents); |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | { |
10 | 10 | //execute the contructor and check for the Object type and attributes |
11 | 11 | $email = new EmailAddress(); |
12 | - $this->assertInstanceOf('EmailAddress',$email); |
|
13 | - $this->assertInstanceOf('SugarEmailAddress',$email); |
|
14 | - $this->assertInstanceOf('SugarBean',$email); |
|
12 | + $this->assertInstanceOf('EmailAddress', $email); |
|
13 | + $this->assertInstanceOf('SugarEmailAddress', $email); |
|
14 | + $this->assertInstanceOf('SugarBean', $email); |
|
15 | 15 | |
16 | 16 | $this->assertAttributeEquals('EmailAddresses', 'module_dir', $email); |
17 | 17 | $this->assertAttributeEquals('EmailAddresses', 'module_name', $email); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $email = new EmailAddress(); |
28 | 28 | |
29 | 29 | $email->email_address = "[email protected]"; |
30 | - $email->invaid_email =0; |
|
30 | + $email->invaid_email = 0; |
|
31 | 31 | |
32 | 32 | $email->save(); |
33 | 33 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | //mark the record as deleted and verify that this record cannot be retrieved anymore. |
40 | 40 | $email->mark_deleted($email->id); |
41 | 41 | $result = $email->retrieve($email->id); |
42 | - $this->assertEquals(null,$result); |
|
42 | + $this->assertEquals(null, $result); |
|
43 | 43 | |
44 | 44 | } |
45 | 45 |