@@ -4,90 +4,90 @@ |
||
4 | 4 | class progress_bar_utilsTest extends PHPUnit_Framework_TestCase |
5 | 5 | { |
6 | 6 | |
7 | - public function testprogress_bar_flush() |
|
8 | - { |
|
9 | - //execute the method and test if it doesn't throw an exception. |
|
10 | - //this method uses flush so we cannot get and verify content printed |
|
11 | - try { |
|
12 | - progress_bar_flush(); |
|
13 | - $this->assertTrue(true); |
|
14 | - } |
|
15 | - catch (Exception $e) { |
|
16 | - $this->fail(); |
|
17 | - } |
|
7 | + public function testprogress_bar_flush() |
|
8 | + { |
|
9 | + //execute the method and test if it doesn't throw an exception. |
|
10 | + //this method uses flush so we cannot get and verify content printed |
|
11 | + try { |
|
12 | + progress_bar_flush(); |
|
13 | + $this->assertTrue(true); |
|
14 | + } |
|
15 | + catch (Exception $e) { |
|
16 | + $this->fail(); |
|
17 | + } |
|
18 | 18 | |
19 | 19 | |
20 | - } |
|
20 | + } |
|
21 | 21 | |
22 | - public function testdisplay_flow_bar() |
|
23 | - { |
|
24 | - //execute the method and test if it doesn't throw an exception. |
|
25 | - //this method uses flush so we cannot get and verify content printed |
|
26 | - try { |
|
27 | - display_flow_bar("test",0); |
|
28 | - $this->assertTrue(true); |
|
29 | - } |
|
30 | - catch (Exception $e) { |
|
31 | - $this->fail(); |
|
32 | - } |
|
22 | + public function testdisplay_flow_bar() |
|
23 | + { |
|
24 | + //execute the method and test if it doesn't throw an exception. |
|
25 | + //this method uses flush so we cannot get and verify content printed |
|
26 | + try { |
|
27 | + display_flow_bar("test",0); |
|
28 | + $this->assertTrue(true); |
|
29 | + } |
|
30 | + catch (Exception $e) { |
|
31 | + $this->fail(); |
|
32 | + } |
|
33 | 33 | |
34 | - } |
|
34 | + } |
|
35 | 35 | |
36 | - public function teststart_flow_bar() |
|
37 | - { |
|
38 | - //execute the method and test if it doesn't throw an exception. |
|
39 | - //this method uses flush so we cannot get and verify content printed |
|
40 | - try { |
|
41 | - start_flow_bar("test", 1); |
|
42 | - $this->assertTrue(true); |
|
43 | - } |
|
44 | - catch (Exception $e) { |
|
45 | - $this->fail(); |
|
46 | - } |
|
36 | + public function teststart_flow_bar() |
|
37 | + { |
|
38 | + //execute the method and test if it doesn't throw an exception. |
|
39 | + //this method uses flush so we cannot get and verify content printed |
|
40 | + try { |
|
41 | + start_flow_bar("test", 1); |
|
42 | + $this->assertTrue(true); |
|
43 | + } |
|
44 | + catch (Exception $e) { |
|
45 | + $this->fail(); |
|
46 | + } |
|
47 | 47 | |
48 | - } |
|
48 | + } |
|
49 | 49 | |
50 | - public function testdestroy_flow_bar() |
|
51 | - { |
|
52 | - //execute the method and test if it doesn't throw an exception. |
|
53 | - //this method uses flush so we cannot get and verify content printed |
|
54 | - try { |
|
55 | - destroy_flow_bar("test"); |
|
56 | - $this->assertTrue(true); |
|
57 | - } |
|
58 | - catch (Exception $e) { |
|
59 | - $this->fail(); |
|
60 | - } |
|
50 | + public function testdestroy_flow_bar() |
|
51 | + { |
|
52 | + //execute the method and test if it doesn't throw an exception. |
|
53 | + //this method uses flush so we cannot get and verify content printed |
|
54 | + try { |
|
55 | + destroy_flow_bar("test"); |
|
56 | + $this->assertTrue(true); |
|
57 | + } |
|
58 | + catch (Exception $e) { |
|
59 | + $this->fail(); |
|
60 | + } |
|
61 | 61 | |
62 | 62 | |
63 | - } |
|
63 | + } |
|
64 | 64 | |
65 | - public function testdisplay_progress_bar() |
|
66 | - { |
|
67 | - //execute the method and test if it doesn't throw an exception. |
|
68 | - //this method uses flush so we cannot get and verify content printed |
|
69 | - try { |
|
70 | - display_progress_bar("test",80, 100); |
|
71 | - $this->assertTrue(true); |
|
72 | - } |
|
73 | - catch (Exception $e) { |
|
74 | - $this->fail(); |
|
75 | - } |
|
65 | + public function testdisplay_progress_bar() |
|
66 | + { |
|
67 | + //execute the method and test if it doesn't throw an exception. |
|
68 | + //this method uses flush so we cannot get and verify content printed |
|
69 | + try { |
|
70 | + display_progress_bar("test",80, 100); |
|
71 | + $this->assertTrue(true); |
|
72 | + } |
|
73 | + catch (Exception $e) { |
|
74 | + $this->fail(); |
|
75 | + } |
|
76 | 76 | |
77 | - } |
|
77 | + } |
|
78 | 78 | |
79 | - public function testupdate_progress_bar() |
|
80 | - { |
|
81 | - //execute the method and test if it doesn't throw an exception. |
|
82 | - //this method uses flush so we cannot get and verify content printed |
|
83 | - try { |
|
84 | - update_progress_bar("test",80, 100); |
|
85 | - $this->assertTrue(true); |
|
86 | - } |
|
87 | - catch (Exception $e) { |
|
88 | - $this->fail(); |
|
89 | - } |
|
79 | + public function testupdate_progress_bar() |
|
80 | + { |
|
81 | + //execute the method and test if it doesn't throw an exception. |
|
82 | + //this method uses flush so we cannot get and verify content printed |
|
83 | + try { |
|
84 | + update_progress_bar("test",80, 100); |
|
85 | + $this->assertTrue(true); |
|
86 | + } |
|
87 | + catch (Exception $e) { |
|
88 | + $this->fail(); |
|
89 | + } |
|
90 | 90 | |
91 | - } |
|
91 | + } |
|
92 | 92 | |
93 | 93 | } |
@@ -4,118 +4,118 @@ discard block |
||
4 | 4 | class LogicHookTest extends PHPUnit_Framework_TestCase { |
5 | 5 | |
6 | 6 | |
7 | - public function testLogicHook() |
|
8 | - { |
|
9 | - //execute the method and test if it doesn't throws an exception |
|
10 | - try { |
|
11 | - $LogicHook = new LogicHook(); |
|
12 | - $this->assertTrue(true); |
|
13 | - } |
|
14 | - catch (Exception $e) { |
|
15 | - $this->fail(); |
|
16 | - } |
|
7 | + public function testLogicHook() |
|
8 | + { |
|
9 | + //execute the method and test if it doesn't throws an exception |
|
10 | + try { |
|
11 | + $LogicHook = new LogicHook(); |
|
12 | + $this->assertTrue(true); |
|
13 | + } |
|
14 | + catch (Exception $e) { |
|
15 | + $this->fail(); |
|
16 | + } |
|
17 | 17 | |
18 | - } |
|
18 | + } |
|
19 | 19 | |
20 | 20 | |
21 | - public function testinitialize() |
|
22 | - { |
|
23 | - //execute the method and test if it returns correct class instances |
|
24 | - $LogicHook = LogicHook::initialize(); |
|
25 | - $this->assertInstanceOf('LogicHook',$LogicHook); |
|
21 | + public function testinitialize() |
|
22 | + { |
|
23 | + //execute the method and test if it returns correct class instances |
|
24 | + $LogicHook = LogicHook::initialize(); |
|
25 | + $this->assertInstanceOf('LogicHook',$LogicHook); |
|
26 | 26 | |
27 | - } |
|
27 | + } |
|
28 | 28 | |
29 | - public function testsetBean() |
|
30 | - { |
|
31 | - //execute the method and test if it returns correct class instances |
|
29 | + public function testsetBean() |
|
30 | + { |
|
31 | + //execute the method and test if it returns correct class instances |
|
32 | 32 | |
33 | - $LogicHook = new LogicHook(); |
|
34 | - $result = $LogicHook->setBean(new User()); |
|
35 | - $this->assertInstanceOf('LogicHook',$result); |
|
36 | - $this->assertInstanceOf('User',$result->bean); |
|
37 | - } |
|
33 | + $LogicHook = new LogicHook(); |
|
34 | + $result = $LogicHook->setBean(new User()); |
|
35 | + $this->assertInstanceOf('LogicHook',$result); |
|
36 | + $this->assertInstanceOf('User',$result->bean); |
|
37 | + } |
|
38 | 38 | |
39 | 39 | |
40 | - public function testgetHooksMap() |
|
41 | - { |
|
42 | - //execute the method and test if it returns true |
|
40 | + public function testgetHooksMap() |
|
41 | + { |
|
42 | + //execute the method and test if it returns true |
|
43 | 43 | |
44 | - $LogicHook = new LogicHook(); |
|
45 | - $hook_map = $LogicHook->getHooksMap(); |
|
46 | - $this->assertTrue(is_array($hook_map)); |
|
44 | + $LogicHook = new LogicHook(); |
|
45 | + $hook_map = $LogicHook->getHooksMap(); |
|
46 | + $this->assertTrue(is_array($hook_map)); |
|
47 | 47 | |
48 | - } |
|
48 | + } |
|
49 | 49 | |
50 | - public function testgetHooksList() |
|
51 | - { |
|
52 | - //execute the method and test if it returns true |
|
50 | + public function testgetHooksList() |
|
51 | + { |
|
52 | + //execute the method and test if it returns true |
|
53 | 53 | |
54 | - $LogicHook = new LogicHook(); |
|
55 | - $hookscan = $LogicHook->getHooksList(); |
|
56 | - $this->assertTrue(is_array($hookscan)); |
|
54 | + $LogicHook = new LogicHook(); |
|
55 | + $hookscan = $LogicHook->getHooksList(); |
|
56 | + $this->assertTrue(is_array($hookscan)); |
|
57 | 57 | |
58 | - } |
|
58 | + } |
|
59 | 59 | |
60 | 60 | public function testscanHooksDir() |
61 | 61 | { |
62 | - error_reporting(E_ERROR | E_PARSE); |
|
62 | + error_reporting(E_ERROR | E_PARSE); |
|
63 | 63 | |
64 | - //execute the method and test if it returns expected contents |
|
64 | + //execute the method and test if it returns expected contents |
|
65 | 65 | |
66 | - $expected_hook_map = array ( |
|
67 | - 'before_save' => |
|
68 | - array ( |
|
69 | - array ( 'file' => 'custom/modules/Accounts/logic_hooks.php', 'index' => 0,), |
|
70 | - ), |
|
71 | - 'after_save' => |
|
72 | - array ( |
|
73 | - array ('file' => 'custom/modules/Accounts/logic_hooks.php', 'index' => 0,), |
|
74 | - array ('file' => 'custom/modules/Accounts/logic_hooks.php', 'index' => 1,), |
|
75 | - array ('file' => 'custom/modules/Accounts/logic_hooks.php','index' => 2,), |
|
76 | - array ('file' => 'custom/modules/Accounts/logic_hooks.php','index' => 3,), |
|
77 | - ), |
|
78 | - 'after_relationship_add' => |
|
79 | - array ( |
|
80 | - array ('file' => 'custom/modules/Accounts/logic_hooks.php', 'index' => 0,), |
|
81 | - ), |
|
82 | - 'after_relationship_delete' => |
|
83 | - array ( |
|
84 | - array ('file' => 'custom/modules/Accounts/logic_hooks.php','index' => 0,), |
|
85 | - ), |
|
86 | - ); |
|
66 | + $expected_hook_map = array ( |
|
67 | + 'before_save' => |
|
68 | + array ( |
|
69 | + array ( 'file' => 'custom/modules/Accounts/logic_hooks.php', 'index' => 0,), |
|
70 | + ), |
|
71 | + 'after_save' => |
|
72 | + array ( |
|
73 | + array ('file' => 'custom/modules/Accounts/logic_hooks.php', 'index' => 0,), |
|
74 | + array ('file' => 'custom/modules/Accounts/logic_hooks.php', 'index' => 1,), |
|
75 | + array ('file' => 'custom/modules/Accounts/logic_hooks.php','index' => 2,), |
|
76 | + array ('file' => 'custom/modules/Accounts/logic_hooks.php','index' => 3,), |
|
77 | + ), |
|
78 | + 'after_relationship_add' => |
|
79 | + array ( |
|
80 | + array ('file' => 'custom/modules/Accounts/logic_hooks.php', 'index' => 0,), |
|
81 | + ), |
|
82 | + 'after_relationship_delete' => |
|
83 | + array ( |
|
84 | + array ('file' => 'custom/modules/Accounts/logic_hooks.php','index' => 0,), |
|
85 | + ), |
|
86 | + ); |
|
87 | 87 | |
88 | 88 | |
89 | - $expected_hookscan = array ( |
|
90 | - 'before_save' => |
|
91 | - array ( |
|
92 | - array (77, 'updateGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateGeocodeInfo',), |
|
93 | - ), |
|
94 | - 'after_save' => |
|
95 | - array ( |
|
96 | - array (77, 'updateRelatedMeetingsGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedMeetingsGeocodeInfo',), |
|
97 | - array (78, 'updateRelatedProjectGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedProjectGeocodeInfo', ), |
|
98 | - array (79, 'updateRelatedOpportunitiesGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedOpportunitiesGeocodeInfo',), |
|
99 | - array (80, 'updateRelatedCasesGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedCasesGeocodeInfo',), |
|
100 | - ), |
|
101 | - 'after_relationship_add' => |
|
102 | - array ( |
|
103 | - array ( 77, 'addRelationship', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'addRelationship',), |
|
104 | - ), |
|
105 | - 'after_relationship_delete' => |
|
106 | - array ( |
|
107 | - array ( 77, 'deleteRelationship', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'deleteRelationship',), |
|
108 | - ), |
|
109 | - ); |
|
89 | + $expected_hookscan = array ( |
|
90 | + 'before_save' => |
|
91 | + array ( |
|
92 | + array (77, 'updateGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateGeocodeInfo',), |
|
93 | + ), |
|
94 | + 'after_save' => |
|
95 | + array ( |
|
96 | + array (77, 'updateRelatedMeetingsGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedMeetingsGeocodeInfo',), |
|
97 | + array (78, 'updateRelatedProjectGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedProjectGeocodeInfo', ), |
|
98 | + array (79, 'updateRelatedOpportunitiesGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedOpportunitiesGeocodeInfo',), |
|
99 | + array (80, 'updateRelatedCasesGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedCasesGeocodeInfo',), |
|
100 | + ), |
|
101 | + 'after_relationship_add' => |
|
102 | + array ( |
|
103 | + array ( 77, 'addRelationship', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'addRelationship',), |
|
104 | + ), |
|
105 | + 'after_relationship_delete' => |
|
106 | + array ( |
|
107 | + array ( 77, 'deleteRelationship', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'deleteRelationship',), |
|
108 | + ), |
|
109 | + ); |
|
110 | 110 | |
111 | - $LogicHook = new LogicHook(); |
|
112 | - $LogicHook->scanHooksDir('custom/modules/Accounts'); |
|
113 | - $hook_map = $LogicHook->getHooksMap(); |
|
114 | - $hookscan = $LogicHook->getHooksList(); |
|
111 | + $LogicHook = new LogicHook(); |
|
112 | + $LogicHook->scanHooksDir('custom/modules/Accounts'); |
|
113 | + $hook_map = $LogicHook->getHooksMap(); |
|
114 | + $hookscan = $LogicHook->getHooksList(); |
|
115 | 115 | |
116 | 116 | |
117 | - $this->assertSame($expected_hook_map,$hook_map); |
|
118 | - $this->assertSame($expected_hookscan,$hookscan); |
|
117 | + $this->assertSame($expected_hook_map,$hook_map); |
|
118 | + $this->assertSame($expected_hookscan,$hookscan); |
|
119 | 119 | |
120 | 120 | |
121 | 121 | } |
@@ -123,162 +123,162 @@ discard block |
||
123 | 123 | |
124 | 124 | public function testrefreshHooks() |
125 | 125 | { |
126 | - //execute the method and test if it doesn't throws an exception |
|
126 | + //execute the method and test if it doesn't throws an exception |
|
127 | 127 | |
128 | - try { |
|
129 | - LogicHook::refreshHooks(); |
|
130 | - $this->assertTrue(true); |
|
131 | - } |
|
132 | - catch (Exception $e) { |
|
133 | - $this->fail(); |
|
134 | - } |
|
128 | + try { |
|
129 | + LogicHook::refreshHooks(); |
|
130 | + $this->assertTrue(true); |
|
131 | + } |
|
132 | + catch (Exception $e) { |
|
133 | + $this->fail(); |
|
134 | + } |
|
135 | 135 | |
136 | 136 | } |
137 | 137 | |
138 | - public function testloadHooks() |
|
139 | - { |
|
140 | - //execute the method and test if it returns expected contents |
|
138 | + public function testloadHooks() |
|
139 | + { |
|
140 | + //execute the method and test if it returns expected contents |
|
141 | 141 | |
142 | - $expected_accounts = array ( |
|
143 | - 'after_ui_frame' => Array (), |
|
144 | - 'before_save' => |
|
145 | - array ( |
|
146 | - array (77, 'updateGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateGeocodeInfo',), |
|
147 | - ), |
|
148 | - 'after_save' => |
|
149 | - array ( |
|
150 | - array (77, 'updateRelatedMeetingsGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedMeetingsGeocodeInfo',), |
|
151 | - array (78, 'updateRelatedProjectGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedProjectGeocodeInfo', ), |
|
152 | - array (79, 'updateRelatedOpportunitiesGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedOpportunitiesGeocodeInfo',), |
|
153 | - array (80, 'updateRelatedCasesGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedCasesGeocodeInfo',), |
|
154 | - ), |
|
155 | - 'after_relationship_add' => |
|
156 | - array ( |
|
157 | - array ( 77, 'addRelationship', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'addRelationship',), |
|
158 | - ), |
|
159 | - 'after_relationship_delete' => |
|
160 | - array ( |
|
161 | - array ( 77, 'deleteRelationship', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'deleteRelationship',), |
|
162 | - ), |
|
163 | - ); |
|
142 | + $expected_accounts = array ( |
|
143 | + 'after_ui_frame' => Array (), |
|
144 | + 'before_save' => |
|
145 | + array ( |
|
146 | + array (77, 'updateGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateGeocodeInfo',), |
|
147 | + ), |
|
148 | + 'after_save' => |
|
149 | + array ( |
|
150 | + array (77, 'updateRelatedMeetingsGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedMeetingsGeocodeInfo',), |
|
151 | + array (78, 'updateRelatedProjectGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedProjectGeocodeInfo', ), |
|
152 | + array (79, 'updateRelatedOpportunitiesGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedOpportunitiesGeocodeInfo',), |
|
153 | + array (80, 'updateRelatedCasesGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedCasesGeocodeInfo',), |
|
154 | + ), |
|
155 | + 'after_relationship_add' => |
|
156 | + array ( |
|
157 | + array ( 77, 'addRelationship', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'addRelationship',), |
|
158 | + ), |
|
159 | + 'after_relationship_delete' => |
|
160 | + array ( |
|
161 | + array ( 77, 'deleteRelationship', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'deleteRelationship',), |
|
162 | + ), |
|
163 | + ); |
|
164 | 164 | |
165 | - $expected_default = array ( |
|
166 | - 'after_ui_footer' => |
|
167 | - array ( |
|
168 | - array (10,'popup_onload','modules/SecurityGroups/AssignGroups.php','AssignGroups','popup_onload',), |
|
169 | - ), |
|
170 | - 'after_ui_frame' => |
|
171 | - array ( |
|
172 | - array (20, 'mass_assign', 'modules/SecurityGroups/AssignGroups.php', 'AssignGroups', 'mass_assign',), |
|
173 | - array ( 1, 'Load Social JS', 'include/social/hooks.php', 'hooks', 'load_js',), |
|
174 | - ), |
|
175 | - 'after_save' => |
|
176 | - array ( |
|
177 | - array ( 30,'popup_select', 'modules/SecurityGroups/AssignGroups.php','AssignGroups','popup_select',), |
|
178 | - array ( 1, 'AOD Index Changes', 'modules/AOD_Index/AOD_LogicHooks.php', 'AOD_LogicHooks', 'saveModuleChanges',), |
|
179 | - array ( 99, 'AOW_Workflow', 'modules/AOW_WorkFlow/AOW_WorkFlow.php', 'AOW_WorkFlow','run_bean_flows',), |
|
180 | - ), |
|
181 | - 'after_delete' => |
|
182 | - array ( |
|
183 | - array ( 1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php', 'AOD_LogicHooks','saveModuleDelete',), |
|
184 | - ), |
|
185 | - 'after_restore' => |
|
186 | - array ( |
|
187 | - array ( 1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php', 'AOD_LogicHooks', 'saveModuleRestore',), |
|
188 | - ), |
|
189 | - ); |
|
165 | + $expected_default = array ( |
|
166 | + 'after_ui_footer' => |
|
167 | + array ( |
|
168 | + array (10,'popup_onload','modules/SecurityGroups/AssignGroups.php','AssignGroups','popup_onload',), |
|
169 | + ), |
|
170 | + 'after_ui_frame' => |
|
171 | + array ( |
|
172 | + array (20, 'mass_assign', 'modules/SecurityGroups/AssignGroups.php', 'AssignGroups', 'mass_assign',), |
|
173 | + array ( 1, 'Load Social JS', 'include/social/hooks.php', 'hooks', 'load_js',), |
|
174 | + ), |
|
175 | + 'after_save' => |
|
176 | + array ( |
|
177 | + array ( 30,'popup_select', 'modules/SecurityGroups/AssignGroups.php','AssignGroups','popup_select',), |
|
178 | + array ( 1, 'AOD Index Changes', 'modules/AOD_Index/AOD_LogicHooks.php', 'AOD_LogicHooks', 'saveModuleChanges',), |
|
179 | + array ( 99, 'AOW_Workflow', 'modules/AOW_WorkFlow/AOW_WorkFlow.php', 'AOW_WorkFlow','run_bean_flows',), |
|
180 | + ), |
|
181 | + 'after_delete' => |
|
182 | + array ( |
|
183 | + array ( 1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php', 'AOD_LogicHooks','saveModuleDelete',), |
|
184 | + ), |
|
185 | + 'after_restore' => |
|
186 | + array ( |
|
187 | + array ( 1, 'AOD Index changes', 'modules/AOD_Index/AOD_LogicHooks.php', 'AOD_LogicHooks', 'saveModuleRestore',), |
|
188 | + ), |
|
189 | + ); |
|
190 | 190 | |
191 | 191 | |
192 | 192 | |
193 | - $LogicHook = new LogicHook(); |
|
193 | + $LogicHook = new LogicHook(); |
|
194 | 194 | |
195 | - //test with a valid module |
|
196 | - $accounts_hooks = $LogicHook->loadHooks('Accounts'); |
|
197 | - $this->assertSame($expected_accounts, $accounts_hooks); |
|
195 | + //test with a valid module |
|
196 | + $accounts_hooks = $LogicHook->loadHooks('Accounts'); |
|
197 | + $this->assertSame($expected_accounts, $accounts_hooks); |
|
198 | 198 | |
199 | - //test with an invalid module, it will get the application hooks |
|
200 | - $default_hooks = $LogicHook->loadHooks(''); |
|
201 | - $this->assertSame($expected_default, $default_hooks); |
|
199 | + //test with an invalid module, it will get the application hooks |
|
200 | + $default_hooks = $LogicHook->loadHooks(''); |
|
201 | + $this->assertSame($expected_default, $default_hooks); |
|
202 | 202 | |
203 | - } |
|
203 | + } |
|
204 | 204 | |
205 | - public function testgetHooks() |
|
206 | - { |
|
207 | - //execute the method and test if it returns expected contents |
|
205 | + public function testgetHooks() |
|
206 | + { |
|
207 | + //execute the method and test if it returns expected contents |
|
208 | 208 | |
209 | - $expected = array ( |
|
210 | - 'after_ui_frame' => Array (), |
|
211 | - 'before_save' => |
|
212 | - array ( |
|
213 | - array (77, 'updateGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateGeocodeInfo',), |
|
214 | - ), |
|
215 | - 'after_save' => |
|
216 | - array ( |
|
217 | - array (77, 'updateRelatedMeetingsGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedMeetingsGeocodeInfo',), |
|
218 | - array (78, 'updateRelatedProjectGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedProjectGeocodeInfo', ), |
|
219 | - array (79, 'updateRelatedOpportunitiesGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedOpportunitiesGeocodeInfo',), |
|
220 | - array (80, 'updateRelatedCasesGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedCasesGeocodeInfo',), |
|
221 | - ), |
|
222 | - 'after_relationship_add' => |
|
223 | - array ( |
|
224 | - array ( 77, 'addRelationship', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'addRelationship',), |
|
225 | - ), |
|
226 | - 'after_relationship_delete' => |
|
227 | - array ( |
|
228 | - array ( 77, 'deleteRelationship', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'deleteRelationship',), |
|
229 | - ), |
|
230 | - ); |
|
209 | + $expected = array ( |
|
210 | + 'after_ui_frame' => Array (), |
|
211 | + 'before_save' => |
|
212 | + array ( |
|
213 | + array (77, 'updateGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateGeocodeInfo',), |
|
214 | + ), |
|
215 | + 'after_save' => |
|
216 | + array ( |
|
217 | + array (77, 'updateRelatedMeetingsGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedMeetingsGeocodeInfo',), |
|
218 | + array (78, 'updateRelatedProjectGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedProjectGeocodeInfo', ), |
|
219 | + array (79, 'updateRelatedOpportunitiesGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedOpportunitiesGeocodeInfo',), |
|
220 | + array (80, 'updateRelatedCasesGeocodeInfo', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'updateRelatedCasesGeocodeInfo',), |
|
221 | + ), |
|
222 | + 'after_relationship_add' => |
|
223 | + array ( |
|
224 | + array ( 77, 'addRelationship', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'addRelationship',), |
|
225 | + ), |
|
226 | + 'after_relationship_delete' => |
|
227 | + array ( |
|
228 | + array ( 77, 'deleteRelationship', 'modules/Accounts/AccountsJjwg_MapsLogicHook.php', 'AccountsJjwg_MapsLogicHook', 'deleteRelationship',), |
|
229 | + ), |
|
230 | + ); |
|
231 | 231 | |
232 | - $LogicHook = new LogicHook(); |
|
232 | + $LogicHook = new LogicHook(); |
|
233 | 233 | |
234 | - //test with refresh false/default |
|
235 | - $hooks = $LogicHook->getHooks('Accounts'); |
|
236 | - $this->assertSame($expected, $hooks); |
|
234 | + //test with refresh false/default |
|
235 | + $hooks = $LogicHook->getHooks('Accounts'); |
|
236 | + $this->assertSame($expected, $hooks); |
|
237 | 237 | |
238 | - //test wit hrefresh true |
|
239 | - $hooks = $LogicHook->getHooks('Accounts',true); |
|
240 | - $this->assertSame($expected, $hooks); |
|
238 | + //test wit hrefresh true |
|
239 | + $hooks = $LogicHook->getHooks('Accounts',true); |
|
240 | + $this->assertSame($expected, $hooks); |
|
241 | 241 | |
242 | 242 | |
243 | 243 | |
244 | - } |
|
244 | + } |
|
245 | 245 | |
246 | 246 | |
247 | - public function testcall_custom_logic() |
|
248 | - { |
|
249 | - //execute the method and test if it doesn't throws an exception |
|
247 | + public function testcall_custom_logic() |
|
248 | + { |
|
249 | + //execute the method and test if it doesn't throws an exception |
|
250 | 250 | |
251 | - $LogicHook = new LogicHook(); |
|
252 | - $LogicHook->setBean(new Account()); |
|
251 | + $LogicHook = new LogicHook(); |
|
252 | + $LogicHook->setBean(new Account()); |
|
253 | 253 | |
254 | - try { |
|
255 | - $LogicHook->call_custom_logic('', 'after_ui_footer'); |
|
256 | - $this->assertTrue(true); |
|
257 | - } |
|
258 | - catch (Exception $e) { |
|
259 | - $this->fail(); |
|
260 | - } |
|
254 | + try { |
|
255 | + $LogicHook->call_custom_logic('', 'after_ui_footer'); |
|
256 | + $this->assertTrue(true); |
|
257 | + } |
|
258 | + catch (Exception $e) { |
|
259 | + $this->fail(); |
|
260 | + } |
|
261 | 261 | |
262 | - } |
|
262 | + } |
|
263 | 263 | |
264 | 264 | |
265 | - public function testprocess_hooks() |
|
266 | - { |
|
267 | - //execute the method and test if it doesn't throws an exception |
|
265 | + public function testprocess_hooks() |
|
266 | + { |
|
267 | + //execute the method and test if it doesn't throws an exception |
|
268 | 268 | |
269 | - $LogicHook = new LogicHook(); |
|
270 | - $LogicHook->setBean(new Account()); |
|
271 | - $hooks = $LogicHook->loadHooks(''); |
|
269 | + $LogicHook = new LogicHook(); |
|
270 | + $LogicHook->setBean(new Account()); |
|
271 | + $hooks = $LogicHook->loadHooks(''); |
|
272 | 272 | |
273 | - try { |
|
274 | - $LogicHook->process_hooks($hooks, 'after_ui_footer',array() ); |
|
275 | - $this->assertTrue(true); |
|
276 | - } |
|
277 | - catch (Exception $e) { |
|
278 | - $this->fail(); |
|
279 | - } |
|
273 | + try { |
|
274 | + $LogicHook->process_hooks($hooks, 'after_ui_footer',array() ); |
|
275 | + $this->assertTrue(true); |
|
276 | + } |
|
277 | + catch (Exception $e) { |
|
278 | + $this->fail(); |
|
279 | + } |
|
280 | 280 | |
281 | - } |
|
281 | + } |
|
282 | 282 | |
283 | 283 | } |
284 | 284 | ?> |
@@ -8,98 +8,98 @@ |
||
8 | 8 | class php_zip_utilsTest extends PHPUnit_Framework_TestCase |
9 | 9 | { |
10 | 10 | |
11 | - public function testunzip() |
|
12 | - { |
|
13 | - //execute the method and test if it returns true and verify the if unzipped files exist |
|
11 | + public function testunzip() |
|
12 | + { |
|
13 | + //execute the method and test if it returns true and verify the if unzipped files exist |
|
14 | 14 | |
15 | - $cache_dir = rtrim($GLOBALS['sugar_config']['cache_dir'], '/\\'); |
|
16 | - $files_list = Array('config.php','config_override.php'); |
|
17 | - $file = $cache_dir . '/zipTest.zip'; |
|
15 | + $cache_dir = rtrim($GLOBALS['sugar_config']['cache_dir'], '/\\'); |
|
16 | + $files_list = Array('config.php','config_override.php'); |
|
17 | + $file = $cache_dir . '/zipTest.zip'; |
|
18 | 18 | |
19 | - //creata a zip file first, to unzip |
|
20 | - if (!file_exists($file)){ |
|
21 | - zip_files_list($file, $files_list); |
|
22 | - } |
|
19 | + //creata a zip file first, to unzip |
|
20 | + if (!file_exists($file)){ |
|
21 | + zip_files_list($file, $files_list); |
|
22 | + } |
|
23 | 23 | |
24 | - $result = unzip( $file , $cache_dir ); |
|
25 | - $this->assertTrue($result); |
|
24 | + $result = unzip( $file , $cache_dir ); |
|
25 | + $this->assertTrue($result); |
|
26 | 26 | |
27 | - $this->assertFileExists($cache_dir .'/config.php'); |
|
28 | - $this->assertFileExists($cache_dir .'/config_override.php'); |
|
27 | + $this->assertFileExists($cache_dir .'/config.php'); |
|
28 | + $this->assertFileExists($cache_dir .'/config_override.php'); |
|
29 | 29 | |
30 | - unlink($cache_dir .'/config.php'); |
|
31 | - unlink($cache_dir .'/config_override.php'); |
|
30 | + unlink($cache_dir .'/config.php'); |
|
31 | + unlink($cache_dir .'/config_override.php'); |
|
32 | 32 | |
33 | - } |
|
33 | + } |
|
34 | 34 | |
35 | 35 | |
36 | - public function testunzip_file( ) |
|
37 | - { |
|
36 | + public function testunzip_file( ) |
|
37 | + { |
|
38 | 38 | |
39 | - //execute the method and test if it returns true and verify the if unzipped files exist |
|
39 | + //execute the method and test if it returns true and verify the if unzipped files exist |
|
40 | 40 | |
41 | - $cache_dir = rtrim($GLOBALS['sugar_config']['cache_dir'], '/\\'); |
|
42 | - $files_list = Array('config.php','config_override.php'); |
|
43 | - $file = $cache_dir . '/zipTest.zip'; |
|
41 | + $cache_dir = rtrim($GLOBALS['sugar_config']['cache_dir'], '/\\'); |
|
42 | + $files_list = Array('config.php','config_override.php'); |
|
43 | + $file = $cache_dir . '/zipTest.zip'; |
|
44 | 44 | |
45 | - //creata a zip file first, to unzip |
|
46 | - if (!file_exists($file)){ |
|
47 | - zip_files_list($file, $files_list); |
|
48 | - } |
|
45 | + //creata a zip file first, to unzip |
|
46 | + if (!file_exists($file)){ |
|
47 | + zip_files_list($file, $files_list); |
|
48 | + } |
|
49 | 49 | |
50 | - $result = unzip_file( $file ,null, $cache_dir ); |
|
51 | - $this->assertTrue($result); |
|
50 | + $result = unzip_file( $file ,null, $cache_dir ); |
|
51 | + $this->assertTrue($result); |
|
52 | 52 | |
53 | 53 | |
54 | - $this->assertFileExists($cache_dir .'/config.php'); |
|
55 | - $this->assertFileExists($cache_dir .'/config_override.php'); |
|
54 | + $this->assertFileExists($cache_dir .'/config.php'); |
|
55 | + $this->assertFileExists($cache_dir .'/config_override.php'); |
|
56 | 56 | |
57 | - unlink($cache_dir .'/config.php'); |
|
58 | - unlink($cache_dir .'/config_override.php'); |
|
57 | + unlink($cache_dir .'/config.php'); |
|
58 | + unlink($cache_dir .'/config_override.php'); |
|
59 | 59 | |
60 | 60 | |
61 | - } |
|
61 | + } |
|
62 | 62 | |
63 | - public function testzip_dir() |
|
64 | - { |
|
65 | - //execute the method and verify the if zipped file exist |
|
66 | - $cache_dir = rtrim($GLOBALS['sugar_config']['cache_dir'], '/\\'); |
|
67 | - $file = $cache_dir . '/zipTest.zip'; |
|
63 | + public function testzip_dir() |
|
64 | + { |
|
65 | + //execute the method and verify the if zipped file exist |
|
66 | + $cache_dir = rtrim($GLOBALS['sugar_config']['cache_dir'], '/\\'); |
|
67 | + $file = $cache_dir . '/zipTest.zip'; |
|
68 | 68 | |
69 | - if (file_exists($file)){ |
|
70 | - unlink($file); |
|
71 | - } |
|
69 | + if (file_exists($file)){ |
|
70 | + unlink($file); |
|
71 | + } |
|
72 | 72 | |
73 | - zip_dir( $cache_dir . '/modules', $file ); |
|
73 | + zip_dir( $cache_dir . '/modules', $file ); |
|
74 | 74 | |
75 | - $this->assertFileExists($file); |
|
75 | + $this->assertFileExists($file); |
|
76 | 76 | |
77 | - unlink($file); |
|
77 | + unlink($file); |
|
78 | 78 | |
79 | 79 | |
80 | - } |
|
80 | + } |
|
81 | 81 | |
82 | 82 | |
83 | - public function testzip_files_list() |
|
84 | - { |
|
83 | + public function testzip_files_list() |
|
84 | + { |
|
85 | 85 | |
86 | - //execute the method and verify the if zipped file exist |
|
87 | - $cache_dir = rtrim($GLOBALS['sugar_config']['cache_dir'], '/\\'); |
|
88 | - $file = $cache_dir . '/ziplistTest.zip'; |
|
89 | - $files_list = Array('config.php','config_override.php'); |
|
86 | + //execute the method and verify the if zipped file exist |
|
87 | + $cache_dir = rtrim($GLOBALS['sugar_config']['cache_dir'], '/\\'); |
|
88 | + $file = $cache_dir . '/ziplistTest.zip'; |
|
89 | + $files_list = Array('config.php','config_override.php'); |
|
90 | 90 | |
91 | - if (file_exists($file)){ |
|
92 | - unlink($file); |
|
93 | - } |
|
91 | + if (file_exists($file)){ |
|
92 | + unlink($file); |
|
93 | + } |
|
94 | 94 | |
95 | - $result = zip_files_list($file, $files_list); |
|
95 | + $result = zip_files_list($file, $files_list); |
|
96 | 96 | |
97 | - $this->assertTrue($result); |
|
98 | - $this->assertFileExists($file); |
|
97 | + $this->assertTrue($result); |
|
98 | + $this->assertFileExists($file); |
|
99 | 99 | |
100 | - unlink($file); |
|
100 | + unlink($file); |
|
101 | 101 | |
102 | 102 | |
103 | - } |
|
103 | + } |
|
104 | 104 | |
105 | 105 | } |
@@ -4,105 +4,105 @@ |
||
4 | 4 | class encryption_utilsTest extends PHPUnit_Framework_TestCase |
5 | 5 | { |
6 | 6 | |
7 | - public function testsugarEncode(){ |
|
7 | + public function testsugarEncode(){ |
|
8 | 8 | |
9 | - //execute the method and test if it returns expected values |
|
10 | - //key param does nothing currently. |
|
9 | + //execute the method and test if it returns expected values |
|
10 | + //key param does nothing currently. |
|
11 | 11 | |
12 | - //blank key and data |
|
13 | - $expected =""; |
|
14 | - $actual = sugarEncode("",""); |
|
15 | - $this->assertSame($expected,$actual); |
|
12 | + //blank key and data |
|
13 | + $expected =""; |
|
14 | + $actual = sugarEncode("",""); |
|
15 | + $this->assertSame($expected,$actual); |
|
16 | 16 | |
17 | - //blank key and valid data |
|
18 | - $expected ="RGF0YQ=="; |
|
19 | - $actual = sugarEncode("","Data"); |
|
20 | - $this->assertSame($expected,$actual); |
|
17 | + //blank key and valid data |
|
18 | + $expected ="RGF0YQ=="; |
|
19 | + $actual = sugarEncode("","Data"); |
|
20 | + $this->assertSame($expected,$actual); |
|
21 | 21 | |
22 | - //valid key and data |
|
23 | - $expected ="RGF0YQ=="; |
|
24 | - $actual = sugarEncode("key","Data"); |
|
25 | - $this->assertSame($expected,$actual); |
|
22 | + //valid key and data |
|
23 | + $expected ="RGF0YQ=="; |
|
24 | + $actual = sugarEncode("key","Data"); |
|
25 | + $this->assertSame($expected,$actual); |
|
26 | 26 | |
27 | - } |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | - public function testsugarDecode(){ |
|
30 | + public function testsugarDecode(){ |
|
31 | 31 | |
32 | - //execute the method and test if it returns expected values |
|
33 | - //key param does nothing currently. |
|
32 | + //execute the method and test if it returns expected values |
|
33 | + //key param does nothing currently. |
|
34 | 34 | |
35 | - //blank key and data |
|
36 | - $expected =""; |
|
37 | - $actual = sugarDecode("",""); |
|
38 | - $this->assertSame($expected,$actual); |
|
35 | + //blank key and data |
|
36 | + $expected =""; |
|
37 | + $actual = sugarDecode("",""); |
|
38 | + $this->assertSame($expected,$actual); |
|
39 | 39 | |
40 | - //blank key and valid data |
|
41 | - $expected ="Data"; |
|
42 | - $actual = sugarDecode("","RGF0YQ=="); |
|
43 | - $this->assertSame($expected,$actual); |
|
40 | + //blank key and valid data |
|
41 | + $expected ="Data"; |
|
42 | + $actual = sugarDecode("","RGF0YQ=="); |
|
43 | + $this->assertSame($expected,$actual); |
|
44 | 44 | |
45 | - //valid key and data |
|
46 | - $expected ="Data"; |
|
47 | - $actual = sugarDecode("key","RGF0YQ=="); |
|
48 | - $this->assertSame($expected,$actual); |
|
45 | + //valid key and data |
|
46 | + $expected ="Data"; |
|
47 | + $actual = sugarDecode("key","RGF0YQ=="); |
|
48 | + $this->assertSame($expected,$actual); |
|
49 | 49 | |
50 | 50 | |
51 | - } |
|
51 | + } |
|
52 | 52 | |
53 | 53 | |
54 | - public function testblowfishGetKey() { |
|
54 | + public function testblowfishGetKey() { |
|
55 | 55 | |
56 | - //execute the method and test if it returns expected length string |
|
56 | + //execute the method and test if it returns expected length string |
|
57 | 57 | |
58 | - //test key |
|
59 | - $actual = blowfishGetKey('test'); |
|
60 | - $this->assertGreaterThanOrEqual(36,strlen($actual)); |
|
61 | - //var_dump($actual); |
|
58 | + //test key |
|
59 | + $actual = blowfishGetKey('test'); |
|
60 | + $this->assertGreaterThanOrEqual(36,strlen($actual)); |
|
61 | + //var_dump($actual); |
|
62 | 62 | |
63 | - //default key |
|
64 | - $actual = blowfishGetKey('rapelcg_svryq'); |
|
65 | - $this->assertGreaterThanOrEqual(36,strlen($actual)); |
|
63 | + //default key |
|
64 | + $actual = blowfishGetKey('rapelcg_svryq'); |
|
65 | + $this->assertGreaterThanOrEqual(36,strlen($actual)); |
|
66 | 66 | |
67 | - } |
|
67 | + } |
|
68 | 68 | |
69 | 69 | |
70 | - public function testblowfishEncode(){ |
|
70 | + public function testblowfishEncode(){ |
|
71 | 71 | |
72 | - //execute the method and test if it returns expected values |
|
73 | - //it won't work with blank key, will throw an error |
|
72 | + //execute the method and test if it returns expected values |
|
73 | + //it won't work with blank key, will throw an error |
|
74 | 74 | |
75 | - //valid key and blank data |
|
76 | - $expected =""; |
|
77 | - $actual = blowfishEncode("test",""); |
|
78 | - $this->assertSame($expected,$actual); |
|
75 | + //valid key and blank data |
|
76 | + $expected =""; |
|
77 | + $actual = blowfishEncode("test",""); |
|
78 | + $this->assertSame($expected,$actual); |
|
79 | 79 | |
80 | 80 | |
81 | - //valid key and valid data |
|
82 | - $expected ="HI1/88NJJss="; |
|
83 | - $actual = blowfishEncode("test","Data"); |
|
84 | - $this->assertSame($expected,$actual); |
|
81 | + //valid key and valid data |
|
82 | + $expected ="HI1/88NJJss="; |
|
83 | + $actual = blowfishEncode("test","Data"); |
|
84 | + $this->assertSame($expected,$actual); |
|
85 | 85 | |
86 | - } |
|
86 | + } |
|
87 | 87 | |
88 | 88 | |
89 | - public function testblowfishDecode(){ |
|
89 | + public function testblowfishDecode(){ |
|
90 | 90 | |
91 | - //execute the method and test if it returns expected values |
|
92 | - //it won't work with blank key, will throw an error. |
|
91 | + //execute the method and test if it returns expected values |
|
92 | + //it won't work with blank key, will throw an error. |
|
93 | 93 | |
94 | - //valid key and blank data |
|
95 | - $expected =""; |
|
96 | - $actual = blowfishDecode("test",""); |
|
97 | - $this->assertSame($expected,$actual); |
|
94 | + //valid key and blank data |
|
95 | + $expected =""; |
|
96 | + $actual = blowfishDecode("test",""); |
|
97 | + $this->assertSame($expected,$actual); |
|
98 | 98 | |
99 | 99 | |
100 | - //valid key and valid data |
|
101 | - $expected ="Data"; |
|
102 | - $actual = blowfishDecode("test","HI1/88NJJss="); |
|
103 | - $this->assertSame($expected,$actual); |
|
100 | + //valid key and valid data |
|
101 | + $expected ="Data"; |
|
102 | + $actual = blowfishDecode("test","HI1/88NJJss="); |
|
103 | + $this->assertSame($expected,$actual); |
|
104 | 104 | |
105 | - } |
|
105 | + } |
|
106 | 106 | |
107 | 107 | } |
108 | 108 | ?> |
109 | 109 | \ No newline at end of file |
@@ -4,277 +4,277 @@ |
||
4 | 4 | class array_utilsTest extends PHPUnit_Framework_TestCase |
5 | 5 | { |
6 | 6 | |
7 | - public function testvar_export_helper() { |
|
7 | + public function testvar_export_helper() { |
|
8 | 8 | |
9 | - //execute the method and test if it returns expected values |
|
9 | + //execute the method and test if it returns expected values |
|
10 | 10 | |
11 | - $tempArray = Array( "Key1" => "value1" , "Key2" => "value2" ); |
|
11 | + $tempArray = Array( "Key1" => "value1" , "Key2" => "value2" ); |
|
12 | 12 | |
13 | - $expected = "array (\n 'Key1' => 'value1',\n 'Key2' => 'value2',\n)"; |
|
14 | - $actual = var_export_helper($tempArray); |
|
15 | - $this->assertSame($actual,$expected); |
|
13 | + $expected = "array (\n 'Key1' => 'value1',\n 'Key2' => 'value2',\n)"; |
|
14 | + $actual = var_export_helper($tempArray); |
|
15 | + $this->assertSame($actual,$expected); |
|
16 | 16 | |
17 | - } |
|
17 | + } |
|
18 | 18 | |
19 | - public function testoverride_value_to_string(){ |
|
19 | + public function testoverride_value_to_string(){ |
|
20 | 20 | |
21 | - //execute the method and test if it returns expected values |
|
21 | + //execute the method and test if it returns expected values |
|
22 | 22 | |
23 | - $expected = "\$array_name['value_name'] = 'value';"; |
|
24 | - $actual = override_value_to_string('array_name', 'value_name', 'value'); |
|
25 | - $this->assertSame($actual,$expected); |
|
23 | + $expected = "\$array_name['value_name'] = 'value';"; |
|
24 | + $actual = override_value_to_string('array_name', 'value_name', 'value'); |
|
25 | + $this->assertSame($actual,$expected); |
|
26 | 26 | |
27 | - } |
|
27 | + } |
|
28 | 28 | |
29 | - public function testadd_blank_option(){ |
|
29 | + public function testadd_blank_option(){ |
|
30 | 30 | |
31 | - //execute the method with array not having any blank key value pair. function will return an array with blank key value pair added. |
|
32 | - $tempArray = Array( "Key1" => "value1" , "Key2" => "value2" ); |
|
33 | - $expected = Array( "" => "" , "Key1" => "value1" , "Key2" => "value2" ); |
|
31 | + //execute the method with array not having any blank key value pair. function will return an array with blank key value pair added. |
|
32 | + $tempArray = Array( "Key1" => "value1" , "Key2" => "value2" ); |
|
33 | + $expected = Array( "" => "" , "Key1" => "value1" , "Key2" => "value2" ); |
|
34 | 34 | |
35 | - $actual = add_blank_option($tempArray); |
|
36 | - $this->assertSame($actual,$expected); |
|
35 | + $actual = add_blank_option($tempArray); |
|
36 | + $this->assertSame($actual,$expected); |
|
37 | 37 | |
38 | 38 | |
39 | - //execute the method with array having a blank key value pair. function will return the same array back without any change. |
|
40 | - $tempArray = Array("" => "" , "Key1" => "value1" , "Key2" => "value2" ); |
|
41 | - $expected = Array( "" => "" , "Key1" => "value1" , "Key2" => "value2" ); |
|
39 | + //execute the method with array having a blank key value pair. function will return the same array back without any change. |
|
40 | + $tempArray = Array("" => "" , "Key1" => "value1" , "Key2" => "value2" ); |
|
41 | + $expected = Array( "" => "" , "Key1" => "value1" , "Key2" => "value2" ); |
|
42 | 42 | |
43 | - $actual = add_blank_option($tempArray); |
|
44 | - $this->assertSame($actual,$expected); |
|
43 | + $actual = add_blank_option($tempArray); |
|
44 | + $this->assertSame($actual,$expected); |
|
45 | 45 | |
46 | - } |
|
46 | + } |
|
47 | 47 | |
48 | 48 | |
49 | - public function testoverride_value_to_string_recursive(){ |
|
49 | + public function testoverride_value_to_string_recursive(){ |
|
50 | 50 | |
51 | - //execute the method and test if it returns expected values |
|
52 | - |
|
53 | - //without keys |
|
54 | - $tempArray = Array( "Key1" => "value1" , "Key2" => "value2" ); |
|
55 | - $expected = "\$tempArray=array (\n 'Key1' => 'value1',\n 'Key2' => 'value2',\n);"; |
|
56 | - $actual = override_value_to_string_recursive('','tempArray',$tempArray); |
|
57 | - $this->assertSame($actual,$expected); |
|
58 | - |
|
59 | - //with keys |
|
60 | - $tempArray = Array(); |
|
61 | - $tempArray["Key1"]["Key2"] = Array( "Key3" => "value" , "Key4" => "value" ); |
|
62 | - $expected = "\$tempArray['key1']['key2']=array (\n 'Key1' => \n array (\n 'Key2' => \n array (\n 'Key3' => 'value',\n 'Key4' => 'value',\n ),\n ),\n);"; |
|
63 | - $actual = override_value_to_string_recursive(array('key1','key2'),'tempArray',$tempArray); |
|
64 | - //var_dump( nl2br($actual)); |
|
65 | - $this->assertSame($actual,$expected); |
|
66 | - |
|
67 | - } |
|
51 | + //execute the method and test if it returns expected values |
|
52 | + |
|
53 | + //without keys |
|
54 | + $tempArray = Array( "Key1" => "value1" , "Key2" => "value2" ); |
|
55 | + $expected = "\$tempArray=array (\n 'Key1' => 'value1',\n 'Key2' => 'value2',\n);"; |
|
56 | + $actual = override_value_to_string_recursive('','tempArray',$tempArray); |
|
57 | + $this->assertSame($actual,$expected); |
|
58 | + |
|
59 | + //with keys |
|
60 | + $tempArray = Array(); |
|
61 | + $tempArray["Key1"]["Key2"] = Array( "Key3" => "value" , "Key4" => "value" ); |
|
62 | + $expected = "\$tempArray['key1']['key2']=array (\n 'Key1' => \n array (\n 'Key2' => \n array (\n 'Key3' => 'value',\n 'Key4' => 'value',\n ),\n ),\n);"; |
|
63 | + $actual = override_value_to_string_recursive(array('key1','key2'),'tempArray',$tempArray); |
|
64 | + //var_dump( nl2br($actual)); |
|
65 | + $this->assertSame($actual,$expected); |
|
66 | + |
|
67 | + } |
|
68 | 68 | |
69 | - public function testoverride_recursive_helper(){ |
|
69 | + public function testoverride_recursive_helper(){ |
|
70 | 70 | |
71 | - //execute the method and test if it returns expected values |
|
72 | - |
|
73 | - //without keys |
|
74 | - $tempArray = Array( "Key1" => "value1" , "Key2" => "value2" ); |
|
75 | - $expected = "=array (\n 'Key1' => 'value1',\n 'Key2' => 'value2',\n);"; |
|
76 | - $actual = override_recursive_helper('','tempArray',$tempArray); |
|
77 | - $this->assertSame($actual,$expected); |
|
78 | - |
|
79 | - //with keys |
|
80 | - $tempArray = Array(); |
|
81 | - $tempArray["Key1"]["Key2"] = Array( "Key3" => "value" , "Key4" => "value" ); |
|
82 | - $expected = "['key1']['key2']=array (\n 'Key1' => \n array (\n 'Key2' => \n array (\n 'Key3' => 'value',\n 'Key4' => 'value',\n ),\n ),\n);"; |
|
83 | - $actual = override_recursive_helper(array('key1','key2'),'tempArray',$tempArray); |
|
84 | - $this->assertSame($actual,$expected); |
|
71 | + //execute the method and test if it returns expected values |
|
72 | + |
|
73 | + //without keys |
|
74 | + $tempArray = Array( "Key1" => "value1" , "Key2" => "value2" ); |
|
75 | + $expected = "=array (\n 'Key1' => 'value1',\n 'Key2' => 'value2',\n);"; |
|
76 | + $actual = override_recursive_helper('','tempArray',$tempArray); |
|
77 | + $this->assertSame($actual,$expected); |
|
78 | + |
|
79 | + //with keys |
|
80 | + $tempArray = Array(); |
|
81 | + $tempArray["Key1"]["Key2"] = Array( "Key3" => "value" , "Key4" => "value" ); |
|
82 | + $expected = "['key1']['key2']=array (\n 'Key1' => \n array (\n 'Key2' => \n array (\n 'Key3' => 'value',\n 'Key4' => 'value',\n ),\n ),\n);"; |
|
83 | + $actual = override_recursive_helper(array('key1','key2'),'tempArray',$tempArray); |
|
84 | + $this->assertSame($actual,$expected); |
|
85 | 85 | |
86 | 86 | |
87 | - } |
|
87 | + } |
|
88 | 88 | |
89 | - public function testoverride_value_to_string_recursive2() { |
|
89 | + public function testoverride_value_to_string_recursive2() { |
|
90 | 90 | |
91 | - //execute the method and test if it returns expected values |
|
91 | + //execute the method and test if it returns expected values |
|
92 | 92 | |
93 | - //null array |
|
94 | - $expected = Null; |
|
95 | - $actual = override_value_to_string_recursive2( 'tempArray', 'key1','',false); |
|
96 | - $this->assertSame($actual,$expected); |
|
93 | + //null array |
|
94 | + $expected = Null; |
|
95 | + $actual = override_value_to_string_recursive2( 'tempArray', 'key1','',false); |
|
96 | + $this->assertSame($actual,$expected); |
|
97 | 97 | |
98 | 98 | |
99 | - //simple array |
|
100 | - $tempArray = Array( "Key1" => "value1" , "Key2" => "value2" ); |
|
101 | - $expected = "\$['tempArray']['Key1'] = 'value1';\n$['tempArray']['Key2'] = 'value2';\n"; |
|
102 | - $actual = override_value_to_string_recursive2( '', 'tempArray', $tempArray); |
|
103 | - $this->assertSame($actual,$expected); |
|
104 | - |
|
105 | - |
|
106 | - //complex array |
|
107 | - $tempArray = Array(); |
|
108 | - $tempArray["Key1"]["Key2"] = Array( "Key3" => "value" , "Key4" => "value" ); |
|
109 | - $expected = "\$tempArray['key1']['Key2']['Key3'] = 'value';\n\$tempArray['key1']['Key2']['Key4'] = 'value';\n"; |
|
110 | - $actual = override_value_to_string_recursive2('tempArray','key1',$tempArray["Key1"]); |
|
111 | - $this->assertSame($actual,$expected); |
|
99 | + //simple array |
|
100 | + $tempArray = Array( "Key1" => "value1" , "Key2" => "value2" ); |
|
101 | + $expected = "\$['tempArray']['Key1'] = 'value1';\n$['tempArray']['Key2'] = 'value2';\n"; |
|
102 | + $actual = override_value_to_string_recursive2( '', 'tempArray', $tempArray); |
|
103 | + $this->assertSame($actual,$expected); |
|
104 | + |
|
105 | + |
|
106 | + //complex array |
|
107 | + $tempArray = Array(); |
|
108 | + $tempArray["Key1"]["Key2"] = Array( "Key3" => "value" , "Key4" => "value" ); |
|
109 | + $expected = "\$tempArray['key1']['Key2']['Key3'] = 'value';\n\$tempArray['key1']['Key2']['Key4'] = 'value';\n"; |
|
110 | + $actual = override_value_to_string_recursive2('tempArray','key1',$tempArray["Key1"]); |
|
111 | + $this->assertSame($actual,$expected); |
|
112 | 112 | |
113 | - } |
|
113 | + } |
|
114 | 114 | |
115 | 115 | |
116 | - public function testobject_to_array_recursive() |
|
117 | - { |
|
118 | - //execute the method and test if it returns expected values |
|
116 | + public function testobject_to_array_recursive() |
|
117 | + { |
|
118 | + //execute the method and test if it returns expected values |
|
119 | 119 | |
120 | - //test invalid input |
|
121 | - $obj = ''; |
|
122 | - $expected = ''; |
|
123 | - $actual = object_to_array_recursive($obj); |
|
124 | - $this->assertSame($actual,$expected); |
|
120 | + //test invalid input |
|
121 | + $obj = ''; |
|
122 | + $expected = ''; |
|
123 | + $actual = object_to_array_recursive($obj); |
|
124 | + $this->assertSame($actual,$expected); |
|
125 | 125 | |
126 | - //test with a valid object |
|
127 | - $obj = new TimeDate(); |
|
128 | - $expected = Array('dbDayFormat' => 'Y-m-d', 'dbTimeFormat' => 'H:i:s', 'allow_cache' => true); |
|
129 | - $actual = object_to_array_recursive($obj); |
|
126 | + //test with a valid object |
|
127 | + $obj = new TimeDate(); |
|
128 | + $expected = Array('dbDayFormat' => 'Y-m-d', 'dbTimeFormat' => 'H:i:s', 'allow_cache' => true); |
|
129 | + $actual = object_to_array_recursive($obj); |
|
130 | 130 | |
131 | - $this->assertSame($actual,$expected); |
|
131 | + $this->assertSame($actual,$expected); |
|
132 | 132 | |
133 | - } |
|
133 | + } |
|
134 | 134 | |
135 | - public function testdeepArrayDiff() { |
|
135 | + public function testdeepArrayDiff() { |
|
136 | 136 | |
137 | - //execute the method and test if it returns expected values |
|
137 | + //execute the method and test if it returns expected values |
|
138 | 138 | |
139 | - //same simple arrays |
|
140 | - $tempArray1 = Array( "Key1" => "value1" , "Key2" => "value2" ); |
|
141 | - $tempArray2 = Array( "Key1" => "value1" , "Key2" => "value2" ); |
|
142 | - $expected = Array(); |
|
143 | - $actual = deepArrayDiff( $tempArray1, $tempArray2); |
|
144 | - $this->assertSame($actual,$expected); |
|
139 | + //same simple arrays |
|
140 | + $tempArray1 = Array( "Key1" => "value1" , "Key2" => "value2" ); |
|
141 | + $tempArray2 = Array( "Key1" => "value1" , "Key2" => "value2" ); |
|
142 | + $expected = Array(); |
|
143 | + $actual = deepArrayDiff( $tempArray1, $tempArray2); |
|
144 | + $this->assertSame($actual,$expected); |
|
145 | 145 | |
146 | 146 | |
147 | - //different simple arrays |
|
148 | - $tempArray1 = Array( "Key1" => "value1" , "Key2" => "value2" ); |
|
149 | - $tempArray2 = Array( "Key1" => "value1" , "Key2" => "value3" ); |
|
150 | - $expected = Array( "Key2" => "value2"); |
|
151 | - $actual = deepArrayDiff( $tempArray1, $tempArray2); |
|
152 | - $this->assertSame($actual,$expected); |
|
147 | + //different simple arrays |
|
148 | + $tempArray1 = Array( "Key1" => "value1" , "Key2" => "value2" ); |
|
149 | + $tempArray2 = Array( "Key1" => "value1" , "Key2" => "value3" ); |
|
150 | + $expected = Array( "Key2" => "value2"); |
|
151 | + $actual = deepArrayDiff( $tempArray1, $tempArray2); |
|
152 | + $this->assertSame($actual,$expected); |
|
153 | 153 | |
154 | 154 | |
155 | - //same complex arrays |
|
156 | - $tempArray1 = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" )); |
|
157 | - $tempArray2 = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" )); |
|
158 | - $expected = Array(); |
|
159 | - $actual = deepArrayDiff( $tempArray1, $tempArray2); |
|
160 | - $this->assertSame($actual,$expected); |
|
161 | - |
|
162 | - |
|
163 | - //complex arrays with different root node |
|
164 | - $tempArray1 = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" )); |
|
165 | - $tempArray2 = Array("Key2" => Array( "Key2" => "value2" , "Key3" => "value3" )); |
|
166 | - $expected = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" )); |
|
167 | - $actual = deepArrayDiff( $tempArray1, $tempArray2); |
|
168 | - $this->assertSame($actual,$expected); |
|
169 | - |
|
170 | - |
|
171 | - //complex arrays with different child node |
|
172 | - $tempArray1 = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" )); |
|
173 | - $tempArray2 = Array("Key1" => Array( "Key2" => "value2" , "Key4" => "value4" )); |
|
174 | - $expected = Array("Key1" => Array( "Key3" => "value3" )); |
|
175 | - $actual = deepArrayDiff( $tempArray1, $tempArray2); |
|
176 | - $this->assertSame($actual,$expected); |
|
155 | + //same complex arrays |
|
156 | + $tempArray1 = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" )); |
|
157 | + $tempArray2 = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" )); |
|
158 | + $expected = Array(); |
|
159 | + $actual = deepArrayDiff( $tempArray1, $tempArray2); |
|
160 | + $this->assertSame($actual,$expected); |
|
161 | + |
|
162 | + |
|
163 | + //complex arrays with different root node |
|
164 | + $tempArray1 = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" )); |
|
165 | + $tempArray2 = Array("Key2" => Array( "Key2" => "value2" , "Key3" => "value3" )); |
|
166 | + $expected = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" )); |
|
167 | + $actual = deepArrayDiff( $tempArray1, $tempArray2); |
|
168 | + $this->assertSame($actual,$expected); |
|
169 | + |
|
170 | + |
|
171 | + //complex arrays with different child node |
|
172 | + $tempArray1 = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" )); |
|
173 | + $tempArray2 = Array("Key1" => Array( "Key2" => "value2" , "Key4" => "value4" )); |
|
174 | + $expected = Array("Key1" => Array( "Key3" => "value3" )); |
|
175 | + $actual = deepArrayDiff( $tempArray1, $tempArray2); |
|
176 | + $this->assertSame($actual,$expected); |
|
177 | 177 | |
178 | - } |
|
178 | + } |
|
179 | 179 | |
180 | 180 | |
181 | - public function testsetDeepArrayValue() { |
|
181 | + public function testsetDeepArrayValue() { |
|
182 | 182 | |
183 | - //execute the method and test if it returns expected values |
|
184 | - |
|
185 | - //add to existing array |
|
186 | - $tempArray = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" )); |
|
187 | - $expected = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" ),"key4" => "value4" ); |
|
188 | - setDeepArrayValue( $tempArray, "key4","value4"); |
|
189 | - $this->assertSame($tempArray,$expected); |
|
190 | - |
|
191 | - //add to empty array |
|
192 | - $tempArray = Array(); |
|
193 | - $expected = Array("key1" => Array( "key2" => Array("key3" => "value3")) ); |
|
194 | - setDeepArrayValue( $tempArray, "key1_key2_key3","value3"); |
|
195 | - //var_dump($tempArray); |
|
196 | - $this->assertSame($tempArray,$expected); |
|
197 | - |
|
198 | - } |
|
183 | + //execute the method and test if it returns expected values |
|
184 | + |
|
185 | + //add to existing array |
|
186 | + $tempArray = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" )); |
|
187 | + $expected = Array("Key1" => Array( "Key2" => "value2" , "Key3" => "value3" ),"key4" => "value4" ); |
|
188 | + setDeepArrayValue( $tempArray, "key4","value4"); |
|
189 | + $this->assertSame($tempArray,$expected); |
|
190 | + |
|
191 | + //add to empty array |
|
192 | + $tempArray = Array(); |
|
193 | + $expected = Array("key1" => Array( "key2" => Array("key3" => "value3")) ); |
|
194 | + setDeepArrayValue( $tempArray, "key1_key2_key3","value3"); |
|
195 | + //var_dump($tempArray); |
|
196 | + $this->assertSame($tempArray,$expected); |
|
197 | + |
|
198 | + } |
|
199 | 199 | |
200 | - public function testarray_merge_values() { |
|
200 | + public function testarray_merge_values() { |
|
201 | 201 | |
202 | - //execute the method and test if it returns expected values |
|
203 | - |
|
204 | - //try with two different length arrays |
|
205 | - $tempArray1 = Array("v1", "v2" , "v3" ); |
|
206 | - $tempArray2 = Array("v4", "v5" ); |
|
207 | - $actual = array_merge_values( $tempArray1, $tempArray2); |
|
208 | - $this->assertFalse($actual); |
|
209 | - |
|
210 | - //try with same length arrays. |
|
211 | - $tempArray1 = Array("v1", "v2" , "v3" ); |
|
212 | - $tempArray2 = Array("v4", "v5" , "v6" ); |
|
213 | - $expected = array("v1v4", "v2v5", "v3v6"); |
|
214 | - $actual = array_merge_values( $tempArray1, $tempArray2); |
|
215 | - $this->assertSame($expected,$actual); |
|
216 | - } |
|
202 | + //execute the method and test if it returns expected values |
|
203 | + |
|
204 | + //try with two different length arrays |
|
205 | + $tempArray1 = Array("v1", "v2" , "v3" ); |
|
206 | + $tempArray2 = Array("v4", "v5" ); |
|
207 | + $actual = array_merge_values( $tempArray1, $tempArray2); |
|
208 | + $this->assertFalse($actual); |
|
209 | + |
|
210 | + //try with same length arrays. |
|
211 | + $tempArray1 = Array("v1", "v2" , "v3" ); |
|
212 | + $tempArray2 = Array("v4", "v5" , "v6" ); |
|
213 | + $expected = array("v1v4", "v2v5", "v3v6"); |
|
214 | + $actual = array_merge_values( $tempArray1, $tempArray2); |
|
215 | + $this->assertSame($expected,$actual); |
|
216 | + } |
|
217 | 217 | |
218 | 218 | |
219 | - public function testarray_search_insensitive() |
|
220 | - { |
|
221 | - //execute the method and test if it returns expected value |
|
219 | + public function testarray_search_insensitive() |
|
220 | + { |
|
221 | + //execute the method and test if it returns expected value |
|
222 | 222 | |
223 | - //test with invalid input |
|
224 | - $tempArray =""; |
|
225 | - $actual = array_search_insensitive('',$tempArray); |
|
226 | - $this->assertFalse($actual); |
|
223 | + //test with invalid input |
|
224 | + $tempArray =""; |
|
225 | + $actual = array_search_insensitive('',$tempArray); |
|
226 | + $this->assertFalse($actual); |
|
227 | 227 | |
228 | 228 | |
229 | - //test with invalid needle.. |
|
230 | - $tempArray = Array("Key1" => "value1", "Key2" => "value2" , "Key3" => "value3" ,"key4" => "value4" ); |
|
231 | - $actual = array_search_insensitive('', $tempArray); |
|
232 | - $this->assertFalse($actual); |
|
229 | + //test with invalid needle.. |
|
230 | + $tempArray = Array("Key1" => "value1", "Key2" => "value2" , "Key3" => "value3" ,"key4" => "value4" ); |
|
231 | + $actual = array_search_insensitive('', $tempArray); |
|
232 | + $this->assertFalse($actual); |
|
233 | 233 | |
234 | 234 | |
235 | - //test with valid needle and haystack. |
|
236 | - $tempArray = Array("Key1" => "value1", "Key2" => "value2" , "Key3" => "value3" ,"key4" => "value4" ); |
|
237 | - $actual = array_search_insensitive('value4', $tempArray); |
|
238 | - $this->assertTrue($actual); |
|
235 | + //test with valid needle and haystack. |
|
236 | + $tempArray = Array("Key1" => "value1", "Key2" => "value2" , "Key3" => "value3" ,"key4" => "value4" ); |
|
237 | + $actual = array_search_insensitive('value4', $tempArray); |
|
238 | + $this->assertTrue($actual); |
|
239 | 239 | |
240 | - //var_dump($actual); |
|
241 | - } |
|
240 | + //var_dump($actual); |
|
241 | + } |
|
242 | 242 | |
243 | 243 | public function testget() { |
244 | 244 | |
245 | - //execute the method and test if it returns expected values |
|
245 | + //execute the method and test if it returns expected values |
|
246 | 246 | |
247 | - //test for a top level key |
|
248 | - $tempArray = new SugarArray(Array("Key1" => Array("Key2" => "value2" , "Key3" => "value3") ,"key4" => "value4" )); |
|
249 | - $expected = "value4"; |
|
250 | - $actual = $tempArray->get('key4'); |
|
251 | - $this->assertSame($expected,$actual); |
|
247 | + //test for a top level key |
|
248 | + $tempArray = new SugarArray(Array("Key1" => Array("Key2" => "value2" , "Key3" => "value3") ,"key4" => "value4" )); |
|
249 | + $expected = "value4"; |
|
250 | + $actual = $tempArray->get('key4'); |
|
251 | + $this->assertSame($expected,$actual); |
|
252 | 252 | |
253 | 253 | |
254 | - //test for a child level key with dot notation |
|
255 | - $tempArray = new SugarArray(Array("key1" => Array("key2" => "value2" , "key3" => "value3") ,"key4" => "value4" )); |
|
256 | - $expected = "value3"; |
|
257 | - $actual = $tempArray->get('key1.key3'); |
|
258 | - $this->assertSame($expected,$actual); |
|
254 | + //test for a child level key with dot notation |
|
255 | + $tempArray = new SugarArray(Array("key1" => Array("key2" => "value2" , "key3" => "value3") ,"key4" => "value4" )); |
|
256 | + $expected = "value3"; |
|
257 | + $actual = $tempArray->get('key1.key3'); |
|
258 | + $this->assertSame($expected,$actual); |
|
259 | 259 | |
260 | 260 | } |
261 | 261 | |
262 | 262 | public function teststaticGet() { |
263 | 263 | |
264 | - //execute the method and test if it returns expected values |
|
264 | + //execute the method and test if it returns expected values |
|
265 | 265 | |
266 | - //test for a top level key |
|
267 | - $haystack = Array("key1" => Array("key2" => "value2" , "key3" => "value3") ,"key4" => "value4" ); |
|
268 | - $expected = "value4"; |
|
269 | - $actual = SugarArray::staticGet($haystack,"key4"); |
|
270 | - $this->assertSame($expected,$actual); |
|
266 | + //test for a top level key |
|
267 | + $haystack = Array("key1" => Array("key2" => "value2" , "key3" => "value3") ,"key4" => "value4" ); |
|
268 | + $expected = "value4"; |
|
269 | + $actual = SugarArray::staticGet($haystack,"key4"); |
|
270 | + $this->assertSame($expected,$actual); |
|
271 | 271 | |
272 | 272 | |
273 | - //test for a child level key with dot notation |
|
274 | - $haystack = Array("key1" => Array("key2" => "value2" , "key3" => "value3") ,"key4" => "value4" ); |
|
275 | - $expected = "value3"; |
|
276 | - $actual = SugarArray::staticGet($haystack,'key1.key3'); |
|
277 | - $this->assertSame($expected,$actual); |
|
273 | + //test for a child level key with dot notation |
|
274 | + $haystack = Array("key1" => Array("key2" => "value2" , "key3" => "value3") ,"key4" => "value4" ); |
|
275 | + $expected = "value3"; |
|
276 | + $actual = SugarArray::staticGet($haystack,'key1.key3'); |
|
277 | + $this->assertSame($expected,$actual); |
|
278 | 278 | |
279 | 279 | |
280 | 280 | } |
@@ -3,55 +3,55 @@ |
||
3 | 3 | require_once 'include/utils/mvc_utils.php'; |
4 | 4 | class mvc_utilsTest extends PHPUnit_Framework_TestCase |
5 | 5 | { |
6 | - public function testloadParentView() |
|
7 | - { |
|
8 | - //execute the method and test if it doesn't throws an exception |
|
9 | - try { |
|
10 | - loadParentView('classic'); |
|
11 | - $this->assertTrue(true); |
|
12 | - } |
|
13 | - catch (Exception $e) { |
|
14 | - $this->fail(); |
|
15 | - } |
|
6 | + public function testloadParentView() |
|
7 | + { |
|
8 | + //execute the method and test if it doesn't throws an exception |
|
9 | + try { |
|
10 | + loadParentView('classic'); |
|
11 | + $this->assertTrue(true); |
|
12 | + } |
|
13 | + catch (Exception $e) { |
|
14 | + $this->fail(); |
|
15 | + } |
|
16 | 16 | |
17 | - } |
|
17 | + } |
|
18 | 18 | |
19 | 19 | |
20 | - public function testgetPrintLink() |
|
21 | - { |
|
22 | - error_reporting(E_ERROR | E_PARSE); |
|
20 | + public function testgetPrintLink() |
|
21 | + { |
|
22 | + error_reporting(E_ERROR | E_PARSE); |
|
23 | 23 | |
24 | - //test without setting REQUEST param |
|
25 | - $expected = "javascript:void window.open('index.php?','printwin','menubar=1,status=0,resizable=1,scrollbars=1,toolbar=0,location=1')"; |
|
26 | - $actual = getPrintLink(); |
|
27 | - $this->assertSame($expected,$actual); |
|
24 | + //test without setting REQUEST param |
|
25 | + $expected = "javascript:void window.open('index.php?','printwin','menubar=1,status=0,resizable=1,scrollbars=1,toolbar=0,location=1')"; |
|
26 | + $actual = getPrintLink(); |
|
27 | + $this->assertSame($expected,$actual); |
|
28 | 28 | |
29 | 29 | |
30 | - //test with required REQUEST param set |
|
31 | - $_REQUEST['action'] = "ajaxui"; |
|
32 | - $expected = "javascript:SUGAR.ajaxUI.print();"; |
|
33 | - $actual = getPrintLink(); |
|
34 | - $this->assertSame($expected,$actual); |
|
30 | + //test with required REQUEST param set |
|
31 | + $_REQUEST['action'] = "ajaxui"; |
|
32 | + $expected = "javascript:SUGAR.ajaxUI.print();"; |
|
33 | + $actual = getPrintLink(); |
|
34 | + $this->assertSame($expected,$actual); |
|
35 | 35 | |
36 | - } |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | - public function testajaxBannedModules() |
|
40 | - { |
|
41 | - //execute the method and test verify it returns true |
|
42 | - $result = ajaxBannedModules(); |
|
43 | - $this->assertTrue(is_array($result)); |
|
44 | - } |
|
39 | + public function testajaxBannedModules() |
|
40 | + { |
|
41 | + //execute the method and test verify it returns true |
|
42 | + $result = ajaxBannedModules(); |
|
43 | + $this->assertTrue(is_array($result)); |
|
44 | + } |
|
45 | 45 | |
46 | 46 | |
47 | - public function testajaxLink() |
|
48 | - { |
|
49 | - //execute the method and test if it returns expected contents |
|
47 | + public function testajaxLink() |
|
48 | + { |
|
49 | + //execute the method and test if it returns expected contents |
|
50 | 50 | |
51 | - $this->assertSame("?action=ajaxui#ajaxUILoc=", ajaxLink()); |
|
52 | - $this->assertSame("index.php?module=Users&action=detail&record=1", ajaxLink('index.php?module=Users&action=detail&record=1')); |
|
53 | - $this->assertSame("?action=ajaxui#ajaxUILoc=module%3DHome%26action%3Ddetail", ajaxLink('module=Home&action=detail')); |
|
51 | + $this->assertSame("?action=ajaxui#ajaxUILoc=", ajaxLink()); |
|
52 | + $this->assertSame("index.php?module=Users&action=detail&record=1", ajaxLink('index.php?module=Users&action=detail&record=1')); |
|
53 | + $this->assertSame("?action=ajaxui#ajaxUILoc=module%3DHome%26action%3Ddetail", ajaxLink('module=Home&action=detail')); |
|
54 | 54 | |
55 | - } |
|
55 | + } |
|
56 | 56 | } |
57 | 57 | ?> |
@@ -2,44 +2,44 @@ |
||
2 | 2 | |
3 | 3 | class AOS_Product_CategoriesTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | - public function testAOS_Product_Categories(){ |
|
5 | + public function testAOS_Product_Categories(){ |
|
6 | 6 | |
7 | - //execute the contructor and check for the Object type and attributes |
|
8 | - $aosProductCategories = new AOS_Product_Categories(); |
|
9 | - $this->assertInstanceOf('AOS_Product_Categories',$aosProductCategories); |
|
10 | - $this->assertInstanceOf('Basic',$aosProductCategories); |
|
11 | - $this->assertInstanceOf('SugarBean',$aosProductCategories); |
|
7 | + //execute the contructor and check for the Object type and attributes |
|
8 | + $aosProductCategories = new AOS_Product_Categories(); |
|
9 | + $this->assertInstanceOf('AOS_Product_Categories',$aosProductCategories); |
|
10 | + $this->assertInstanceOf('Basic',$aosProductCategories); |
|
11 | + $this->assertInstanceOf('SugarBean',$aosProductCategories); |
|
12 | 12 | |
13 | - $this->assertAttributeEquals('AOS_Product_Categories', 'module_dir', $aosProductCategories); |
|
14 | - $this->assertAttributeEquals('AOS_Product_Categories', 'object_name', $aosProductCategories); |
|
15 | - $this->assertAttributeEquals('aos_product_categories', 'table_name', $aosProductCategories); |
|
16 | - $this->assertAttributeEquals(true, 'new_schema', $aosProductCategories); |
|
17 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $aosProductCategories); |
|
18 | - $this->assertAttributeEquals(true, 'importable', $aosProductCategories); |
|
13 | + $this->assertAttributeEquals('AOS_Product_Categories', 'module_dir', $aosProductCategories); |
|
14 | + $this->assertAttributeEquals('AOS_Product_Categories', 'object_name', $aosProductCategories); |
|
15 | + $this->assertAttributeEquals('aos_product_categories', 'table_name', $aosProductCategories); |
|
16 | + $this->assertAttributeEquals(true, 'new_schema', $aosProductCategories); |
|
17 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $aosProductCategories); |
|
18 | + $this->assertAttributeEquals(true, 'importable', $aosProductCategories); |
|
19 | 19 | |
20 | - } |
|
20 | + } |
|
21 | 21 | |
22 | 22 | |
23 | 23 | public function testsave(){ |
24 | 24 | |
25 | - error_reporting(E_ERROR | E_PARSE); |
|
25 | + error_reporting(E_ERROR | E_PARSE); |
|
26 | 26 | |
27 | - $aosProductCategories = new AOS_Product_Categories(); |
|
28 | - $aosProductCategories->name = "test"; |
|
29 | - $aosProductCategories->parent_category_id = 1; |
|
27 | + $aosProductCategories = new AOS_Product_Categories(); |
|
28 | + $aosProductCategories->name = "test"; |
|
29 | + $aosProductCategories->parent_category_id = 1; |
|
30 | 30 | |
31 | - $aosProductCategories->save(); |
|
31 | + $aosProductCategories->save(); |
|
32 | 32 | |
33 | 33 | |
34 | - //test for record ID to verify that record is saved |
|
35 | - $this->assertTrue(isset($aosProductCategories->id)); |
|
36 | - $this->assertEquals(36, strlen($aosProductCategories->id)); |
|
34 | + //test for record ID to verify that record is saved |
|
35 | + $this->assertTrue(isset($aosProductCategories->id)); |
|
36 | + $this->assertEquals(36, strlen($aosProductCategories->id)); |
|
37 | 37 | |
38 | 38 | |
39 | - //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
40 | - $aosProductCategories->mark_deleted($aosProductCategories->id); |
|
41 | - $result = $aosProductCategories->retrieve($aosProductCategories->id); |
|
42 | - $this->assertEquals(null,$result); |
|
39 | + //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
40 | + $aosProductCategories->mark_deleted($aosProductCategories->id); |
|
41 | + $result = $aosProductCategories->retrieve($aosProductCategories->id); |
|
42 | + $this->assertEquals(null,$result); |
|
43 | 43 | |
44 | 44 | } |
45 | 45 |
@@ -2,80 +2,80 @@ |
||
2 | 2 | |
3 | 3 | class AOS_ContractsTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | - public function testAOS_Contracts(){ |
|
5 | + public function testAOS_Contracts(){ |
|
6 | 6 | |
7 | - //execute the contructor and check for the Object type and attributes |
|
8 | - $aosContracts = new AOS_Contracts(); |
|
9 | - $this->assertInstanceOf('AOS_Contracts',$aosContracts); |
|
10 | - $this->assertInstanceOf('Basic',$aosContracts); |
|
11 | - $this->assertInstanceOf('SugarBean',$aosContracts); |
|
7 | + //execute the contructor and check for the Object type and attributes |
|
8 | + $aosContracts = new AOS_Contracts(); |
|
9 | + $this->assertInstanceOf('AOS_Contracts',$aosContracts); |
|
10 | + $this->assertInstanceOf('Basic',$aosContracts); |
|
11 | + $this->assertInstanceOf('SugarBean',$aosContracts); |
|
12 | 12 | |
13 | - $this->assertAttributeEquals('AOS_Contracts', 'module_dir', $aosContracts); |
|
14 | - $this->assertAttributeEquals('AOS_Contracts', 'object_name', $aosContracts); |
|
15 | - $this->assertAttributeEquals('aos_contracts', 'table_name', $aosContracts); |
|
16 | - $this->assertAttributeEquals(true, 'new_schema', $aosContracts); |
|
17 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $aosContracts); |
|
18 | - $this->assertAttributeEquals(true, 'importable', $aosContracts); |
|
13 | + $this->assertAttributeEquals('AOS_Contracts', 'module_dir', $aosContracts); |
|
14 | + $this->assertAttributeEquals('AOS_Contracts', 'object_name', $aosContracts); |
|
15 | + $this->assertAttributeEquals('aos_contracts', 'table_name', $aosContracts); |
|
16 | + $this->assertAttributeEquals(true, 'new_schema', $aosContracts); |
|
17 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $aosContracts); |
|
18 | + $this->assertAttributeEquals(true, 'importable', $aosContracts); |
|
19 | 19 | |
20 | - $this->assertTrue(isset($aosContracts->renewal_reminder_date)); |
|
20 | + $this->assertTrue(isset($aosContracts->renewal_reminder_date)); |
|
21 | 21 | |
22 | - } |
|
22 | + } |
|
23 | 23 | |
24 | - public function testsaveAndDelete(){ |
|
24 | + public function testsaveAndDelete(){ |
|
25 | 25 | |
26 | - error_reporting(E_ERROR | E_PARSE); |
|
26 | + error_reporting(E_ERROR | E_PARSE); |
|
27 | 27 | |
28 | - $aosContracts = new AOS_Contracts(); |
|
29 | - $aosContracts->name = "test"; |
|
28 | + $aosContracts = new AOS_Contracts(); |
|
29 | + $aosContracts->name = "test"; |
|
30 | 30 | |
31 | - $aosContracts->save(); |
|
31 | + $aosContracts->save(); |
|
32 | 32 | |
33 | 33 | |
34 | - //test for record ID to verify that record is saved |
|
35 | - $this->assertTrue(isset($aosContracts->id)); |
|
36 | - $this->assertEquals(36, strlen($aosContracts->id)); |
|
34 | + //test for record ID to verify that record is saved |
|
35 | + $this->assertTrue(isset($aosContracts->id)); |
|
36 | + $this->assertEquals(36, strlen($aosContracts->id)); |
|
37 | 37 | |
38 | 38 | |
39 | - //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
40 | - $aosContracts->mark_deleted($aosContracts->id); |
|
41 | - $result = $aosContracts->retrieve($aosContracts->id); |
|
42 | - $this->assertEquals(null,$result); |
|
39 | + //mark the record as deleted and verify that this record cannot be retrieved anymore. |
|
40 | + $aosContracts->mark_deleted($aosContracts->id); |
|
41 | + $result = $aosContracts->retrieve($aosContracts->id); |
|
42 | + $this->assertEquals(null,$result); |
|
43 | 43 | |
44 | - } |
|
44 | + } |
|
45 | 45 | |
46 | 46 | |
47 | - public function testCreateReminderAndCreateLinkAndDeleteCall(){ |
|
47 | + public function testCreateReminderAndCreateLinkAndDeleteCall(){ |
|
48 | 48 | |
49 | - $call = new call(); |
|
49 | + $call = new call(); |
|
50 | 50 | |
51 | - $aosContracts = new AOS_Contracts(); |
|
52 | - $aosContracts->name = "test"; |
|
51 | + $aosContracts = new AOS_Contracts(); |
|
52 | + $aosContracts->name = "test"; |
|
53 | 53 | |
54 | 54 | |
55 | - //test createReminder() |
|
56 | - $aosContracts->createReminder(); |
|
55 | + //test createReminder() |
|
56 | + $aosContracts->createReminder(); |
|
57 | 57 | |
58 | - //verify record ID to check that record is saved |
|
59 | - $this->assertTrue(isset($aosContracts->call_id)); |
|
60 | - $this->assertEquals(36, strlen($aosContracts->call_id)); |
|
58 | + //verify record ID to check that record is saved |
|
59 | + $this->assertTrue(isset($aosContracts->call_id)); |
|
60 | + $this->assertEquals(36, strlen($aosContracts->call_id)); |
|
61 | 61 | |
62 | - //verify the parent_type value set by createReminder() |
|
63 | - $call->retrieve($aosContracts->call_id); |
|
64 | - $this->assertAttributeEquals('AOS_Contracts', 'parent_type', $call); |
|
62 | + //verify the parent_type value set by createReminder() |
|
63 | + $call->retrieve($aosContracts->call_id); |
|
64 | + $this->assertAttributeEquals('AOS_Contracts', 'parent_type', $call); |
|
65 | 65 | |
66 | 66 | |
67 | - //test createLink() and verify the parent_type value |
|
68 | - $aosContracts->createLink(); |
|
69 | - $call->retrieve($aosContracts->call_id); |
|
70 | - $this->assertAttributeEquals('Accounts', 'parent_type', $call); |
|
67 | + //test createLink() and verify the parent_type value |
|
68 | + $aosContracts->createLink(); |
|
69 | + $call->retrieve($aosContracts->call_id); |
|
70 | + $this->assertAttributeEquals('Accounts', 'parent_type', $call); |
|
71 | 71 | |
72 | 72 | |
73 | - //delete the call and verify that this record cannot be retrieved anymore. |
|
74 | - $aosContracts->deleteCall(); |
|
75 | - $call->retrieve($aosContracts->call_id); |
|
76 | - $this->assertEquals(null,$result); |
|
73 | + //delete the call and verify that this record cannot be retrieved anymore. |
|
74 | + $aosContracts->deleteCall(); |
|
75 | + $call->retrieve($aosContracts->call_id); |
|
76 | + $this->assertEquals(null,$result); |
|
77 | 77 | |
78 | - } |
|
78 | + } |
|
79 | 79 | |
80 | 80 | |
81 | 81 | } |
@@ -2,23 +2,23 @@ |
||
2 | 2 | |
3 | 3 | class FP_Event_LocationsTest extends PHPUnit_Framework_TestCase { |
4 | 4 | |
5 | - public function testFP_Event_Locations(){ |
|
5 | + public function testFP_Event_Locations(){ |
|
6 | 6 | |
7 | 7 | |
8 | - //execute the contructor and check for the Object type and attributes |
|
9 | - $fpEventLoc = new FP_Event_Locations(); |
|
10 | - $this->assertInstanceOf('FP_Event_Locations',$fpEventLoc); |
|
11 | - $this->assertInstanceOf('Basic',$fpEventLoc); |
|
12 | - $this->assertInstanceOf('SugarBean',$fpEventLoc); |
|
8 | + //execute the contructor and check for the Object type and attributes |
|
9 | + $fpEventLoc = new FP_Event_Locations(); |
|
10 | + $this->assertInstanceOf('FP_Event_Locations',$fpEventLoc); |
|
11 | + $this->assertInstanceOf('Basic',$fpEventLoc); |
|
12 | + $this->assertInstanceOf('SugarBean',$fpEventLoc); |
|
13 | 13 | |
14 | - $this->assertAttributeEquals('FP_Event_Locations', 'module_dir', $fpEventLoc); |
|
15 | - $this->assertAttributeEquals('FP_Event_Locations', 'object_name', $fpEventLoc); |
|
16 | - $this->assertAttributeEquals('fp_event_locations', 'table_name', $fpEventLoc); |
|
17 | - $this->assertAttributeEquals(true, 'new_schema', $fpEventLoc); |
|
18 | - $this->assertAttributeEquals(false, 'importable', $fpEventLoc); |
|
19 | - $this->assertAttributeEquals(true, 'disable_row_level_security', $fpEventLoc); |
|
14 | + $this->assertAttributeEquals('FP_Event_Locations', 'module_dir', $fpEventLoc); |
|
15 | + $this->assertAttributeEquals('FP_Event_Locations', 'object_name', $fpEventLoc); |
|
16 | + $this->assertAttributeEquals('fp_event_locations', 'table_name', $fpEventLoc); |
|
17 | + $this->assertAttributeEquals(true, 'new_schema', $fpEventLoc); |
|
18 | + $this->assertAttributeEquals(false, 'importable', $fpEventLoc); |
|
19 | + $this->assertAttributeEquals(true, 'disable_row_level_security', $fpEventLoc); |
|
20 | 20 | |
21 | - } |
|
21 | + } |
|
22 | 22 | |
23 | 23 | } |
24 | 24 | ?> |
25 | 25 | \ No newline at end of file |