@@ -1,27 +1,27 @@ |
||
| 1 | 1 | <?php |
| 2 | - /** |
|
| 3 | - * |
|
| 4 | - * |
|
| 5 | - * @package |
|
| 6 | - * @copyright SalesAgility Ltd http://www.salesagility.com |
|
| 7 | - * |
|
| 8 | - * This program is free software; you can redistribute it and/or modify |
|
| 9 | - * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by |
|
| 10 | - * the Free Software Foundation; either version 3 of the License, or |
|
| 11 | - * (at your option) any later version. |
|
| 12 | - * |
|
| 13 | - * This program is distributed in the hope that it will be useful, |
|
| 14 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 15 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 16 | - * GNU General Public License for more details. |
|
| 17 | - * |
|
| 18 | - * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|
| 19 | - * along with this program; if not, see http://www.gnu.org/licenses |
|
| 20 | - * or write to the Free Software Foundation,Inc., 51 Franklin Street, |
|
| 21 | - * Fifth Floor, Boston, MA 02110-1301 USA |
|
| 22 | - * |
|
| 23 | - * @author Salesagility Ltd <[email protected]> |
|
| 24 | - */ |
|
| 2 | + /** |
|
| 3 | + * |
|
| 4 | + * |
|
| 5 | + * @package |
|
| 6 | + * @copyright SalesAgility Ltd http://www.salesagility.com |
|
| 7 | + * |
|
| 8 | + * This program is free software; you can redistribute it and/or modify |
|
| 9 | + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by |
|
| 10 | + * the Free Software Foundation; either version 3 of the License, or |
|
| 11 | + * (at your option) any later version. |
|
| 12 | + * |
|
| 13 | + * This program is distributed in the hope that it will be useful, |
|
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 16 | + * GNU General Public License for more details. |
|
| 17 | + * |
|
| 18 | + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|
| 19 | + * along with this program; if not, see http://www.gnu.org/licenses |
|
| 20 | + * or write to the Free Software Foundation,Inc., 51 Franklin Street, |
|
| 21 | + * Fifth Floor, Boston, MA 02110-1301 USA |
|
| 22 | + * |
|
| 23 | + * @author Salesagility Ltd <[email protected]> |
|
| 24 | + */ |
|
| 25 | 25 | require_once 'modules/InboundEmail/InboundEmail.php'; |
| 26 | 26 | require_once 'include/clean.php'; |
| 27 | 27 | class AOPInboundEmail extends InboundEmail { |
@@ -3,11 +3,11 @@ |
||
| 3 | 3 | class configTest extends PHPUnit_Framework_TestCase |
| 4 | 4 | { |
| 5 | 5 | |
| 6 | - public function test_config() { |
|
| 7 | - global $sugar_config; |
|
| 8 | - $this->assertNotEmpty($sugar_config,"SuiteCRM config is empty"); |
|
| 6 | + public function test_config() { |
|
| 7 | + global $sugar_config; |
|
| 8 | + $this->assertNotEmpty($sugar_config,"SuiteCRM config is empty"); |
|
| 9 | 9 | |
| 10 | - } |
|
| 10 | + } |
|
| 11 | 11 | |
| 12 | 12 | |
| 13 | 13 | } |
@@ -5,25 +5,25 @@ discard block |
||
| 5 | 5 | { |
| 6 | 6 | |
| 7 | 7 | |
| 8 | - public function testexecute(){ |
|
| 8 | + public function testexecute(){ |
|
| 9 | 9 | |
| 10 | - $SugarApplication = new SugarApplication(); |
|
| 10 | + $SugarApplication = new SugarApplication(); |
|
| 11 | 11 | |
| 12 | - //execute the method and test if it works and does not throws an exception other than headers output exception. |
|
| 13 | - try { |
|
| 14 | - $SugarApplication->execute(); |
|
| 12 | + //execute the method and test if it works and does not throws an exception other than headers output exception. |
|
| 13 | + try { |
|
| 14 | + $SugarApplication->execute(); |
|
| 15 | 15 | |
| 16 | - } catch (Exception $e) { |
|
| 17 | - $this->assertStringStartsWith('Cannot modify header information',$e->getMessage()); |
|
| 18 | - } |
|
| 16 | + } catch (Exception $e) { |
|
| 17 | + $this->assertStringStartsWith('Cannot modify header information',$e->getMessage()); |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - } |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | 22 | |
| 23 | - public function testloadUser(){ |
|
| 23 | + public function testloadUser(){ |
|
| 24 | 24 | |
| 25 | - //cannot test this method as it uses die which stops execution of php unit as well |
|
| 26 | - /* |
|
| 25 | + //cannot test this method as it uses die which stops execution of php unit as well |
|
| 26 | + /* |
|
| 27 | 27 | error_reporting(E_ERROR | E_PARSE); |
| 28 | 28 | |
| 29 | 29 | $SugarApplication = new SugarApplication(); |
@@ -38,269 +38,269 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | $this->assertTrue(TRUE); |
| 40 | 40 | */ |
| 41 | - $this->markTestIncomplete('Can Not be implemented'); |
|
| 41 | + $this->markTestIncomplete('Can Not be implemented'); |
|
| 42 | 42 | |
| 43 | - } |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - public function testACLFilter(){ |
|
| 45 | + public function testACLFilter(){ |
|
| 46 | 46 | |
| 47 | - $SugarApplication = new SugarApplication(); |
|
| 47 | + $SugarApplication = new SugarApplication(); |
|
| 48 | 48 | |
| 49 | - //execute the method and test if it works and does not throws an exception. |
|
| 50 | - try { |
|
| 51 | - $SugarApplication->ACLFilter(); |
|
| 52 | - } |
|
| 53 | - catch (Exception $e) { |
|
| 54 | - $this->fail(); |
|
| 55 | - } |
|
| 49 | + //execute the method and test if it works and does not throws an exception. |
|
| 50 | + try { |
|
| 51 | + $SugarApplication->ACLFilter(); |
|
| 52 | + } |
|
| 53 | + catch (Exception $e) { |
|
| 54 | + $this->fail(); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - $this->assertTrue(TRUE); |
|
| 57 | + $this->assertTrue(TRUE); |
|
| 58 | 58 | |
| 59 | - } |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | 61 | |
| 62 | - public function testsetupResourceManagement() { |
|
| 62 | + public function testsetupResourceManagement() { |
|
| 63 | 63 | |
| 64 | 64 | |
| 65 | - $SugarApplication = new SugarApplication(); |
|
| 65 | + $SugarApplication = new SugarApplication(); |
|
| 66 | 66 | |
| 67 | - //execute the method with invalid input and test if it works and does not throws an exception. |
|
| 68 | - try { |
|
| 69 | - $SugarApplication->setupResourceManagement(''); |
|
| 70 | - } |
|
| 71 | - catch (Exception $e) { |
|
| 72 | - $this->fail(); |
|
| 73 | - } |
|
| 67 | + //execute the method with invalid input and test if it works and does not throws an exception. |
|
| 68 | + try { |
|
| 69 | + $SugarApplication->setupResourceManagement(''); |
|
| 70 | + } |
|
| 71 | + catch (Exception $e) { |
|
| 72 | + $this->fail(); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - //execute the method with valid input and test if it works and does not throws an exception. |
|
| 76 | - try { |
|
| 77 | - $SugarApplication->setupResourceManagement('Users'); |
|
| 78 | - } |
|
| 79 | - catch (Exception $e) { |
|
| 80 | - $this->fail(); |
|
| 81 | - } |
|
| 75 | + //execute the method with valid input and test if it works and does not throws an exception. |
|
| 76 | + try { |
|
| 77 | + $SugarApplication->setupResourceManagement('Users'); |
|
| 78 | + } |
|
| 79 | + catch (Exception $e) { |
|
| 80 | + $this->fail(); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - $this->assertTrue(TRUE); |
|
| 83 | + $this->assertTrue(TRUE); |
|
| 84 | 84 | |
| 85 | - } |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - public function testsetupPrint() { |
|
| 87 | + public function testsetupPrint() { |
|
| 88 | 88 | |
| 89 | - $SugarApplication = new SugarApplication(); |
|
| 89 | + $SugarApplication = new SugarApplication(); |
|
| 90 | 90 | |
| 91 | - //execute the method and test if it works and does not throws an exception. |
|
| 92 | - try { |
|
| 93 | - $SugarApplication->setupPrint(); |
|
| 94 | - } |
|
| 95 | - catch (Exception $e) { |
|
| 96 | - $this->fail(); |
|
| 97 | - } |
|
| 91 | + //execute the method and test if it works and does not throws an exception. |
|
| 92 | + try { |
|
| 93 | + $SugarApplication->setupPrint(); |
|
| 94 | + } |
|
| 95 | + catch (Exception $e) { |
|
| 96 | + $this->fail(); |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - $this->assertTrue(TRUE); |
|
| 99 | + $this->assertTrue(TRUE); |
|
| 100 | 100 | |
| 101 | - } |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - public function testpreProcess(){ |
|
| 103 | + public function testpreProcess(){ |
|
| 104 | 104 | |
| 105 | - $SugarApplication = new SugarApplication(); |
|
| 106 | - $SugarApplication->controller = new SugarController(); |
|
| 105 | + $SugarApplication = new SugarApplication(); |
|
| 106 | + $SugarApplication->controller = new SugarController(); |
|
| 107 | 107 | |
| 108 | - //execute the method and test if it works and does not throws an exception. |
|
| 109 | - try { |
|
| 110 | - $SugarApplication->preProcess(); |
|
| 111 | - } |
|
| 112 | - catch (Exception $e) { |
|
| 113 | - $this->fail(); |
|
| 114 | - } |
|
| 108 | + //execute the method and test if it works and does not throws an exception. |
|
| 109 | + try { |
|
| 110 | + $SugarApplication->preProcess(); |
|
| 111 | + } |
|
| 112 | + catch (Exception $e) { |
|
| 113 | + $this->fail(); |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | - $this->assertTrue(TRUE); |
|
| 116 | + $this->assertTrue(TRUE); |
|
| 117 | 117 | |
| 118 | - } |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | 120 | |
| 121 | - public function testhandleOfflineClient(){ |
|
| 122 | - $SugarApplication = new SugarApplication(); |
|
| 121 | + public function testhandleOfflineClient(){ |
|
| 122 | + $SugarApplication = new SugarApplication(); |
|
| 123 | 123 | |
| 124 | - //execute the method and test if it works and does not throws an exception. |
|
| 125 | - try { |
|
| 126 | - $SugarApplication->handleOfflineClient(); |
|
| 127 | - } |
|
| 128 | - catch (Exception $e) { |
|
| 129 | - $this->fail(); |
|
| 130 | - } |
|
| 124 | + //execute the method and test if it works and does not throws an exception. |
|
| 125 | + try { |
|
| 126 | + $SugarApplication->handleOfflineClient(); |
|
| 127 | + } |
|
| 128 | + catch (Exception $e) { |
|
| 129 | + $this->fail(); |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | - $this->assertTrue(TRUE); |
|
| 133 | - } |
|
| 132 | + $this->assertTrue(TRUE); |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | 135 | |
| 136 | - public function testhandleAccessControl(){ |
|
| 136 | + public function testhandleAccessControl(){ |
|
| 137 | 137 | |
| 138 | - $SugarApplication = new SugarApplication(); |
|
| 139 | - $SugarApplication->controller = new SugarController(); |
|
| 138 | + $SugarApplication = new SugarApplication(); |
|
| 139 | + $SugarApplication->controller = new SugarController(); |
|
| 140 | 140 | |
| 141 | - $result = $SugarApplication->handleAccessControl(); |
|
| 141 | + $result = $SugarApplication->handleAccessControl(); |
|
| 142 | 142 | |
| 143 | - //check that it returns Null |
|
| 144 | - $this->assertEquals(NULL,$result); |
|
| 143 | + //check that it returns Null |
|
| 144 | + $this->assertEquals(NULL,$result); |
|
| 145 | 145 | |
| 146 | - //check that controller->hasAccess is true i-e default setting. |
|
| 147 | - $this->assertEquals(True,$SugarApplication->controller->hasAccess); |
|
| 146 | + //check that controller->hasAccess is true i-e default setting. |
|
| 147 | + $this->assertEquals(True,$SugarApplication->controller->hasAccess); |
|
| 148 | 148 | |
| 149 | - } |
|
| 149 | + } |
|
| 150 | 150 | |
| 151 | 151 | |
| 152 | - public function testpreLoadLanguages() |
|
| 153 | - { |
|
| 154 | - try { |
|
| 155 | - SugarApplication::preLoadLanguages(); |
|
| 152 | + public function testpreLoadLanguages() |
|
| 153 | + { |
|
| 154 | + try { |
|
| 155 | + SugarApplication::preLoadLanguages(); |
|
| 156 | 156 | |
| 157 | - //check that method call got the current_language global variable set. |
|
| 158 | - $this->assertTrue(isset($GLOBALS['current_language'] )); |
|
| 157 | + //check that method call got the current_language global variable set. |
|
| 158 | + $this->assertTrue(isset($GLOBALS['current_language'] )); |
|
| 159 | 159 | |
| 160 | - //check that method call got the app_strings global variable set. |
|
| 161 | - $this->assertTrue(is_array($GLOBALS['app_strings']) && count($GLOBALS['app_strings']) > 0 ); |
|
| 160 | + //check that method call got the app_strings global variable set. |
|
| 161 | + $this->assertTrue(is_array($GLOBALS['app_strings']) && count($GLOBALS['app_strings']) > 0 ); |
|
| 162 | 162 | |
| 163 | - } |
|
| 164 | - catch (Exception $e) { |
|
| 165 | - $this->fail(); |
|
| 166 | - } |
|
| 163 | + } |
|
| 164 | + catch (Exception $e) { |
|
| 165 | + $this->fail(); |
|
| 166 | + } |
|
| 167 | 167 | |
| 168 | - } |
|
| 168 | + } |
|
| 169 | 169 | |
| 170 | - public function testloadLanguages(){ |
|
| 170 | + public function testloadLanguages(){ |
|
| 171 | 171 | |
| 172 | - $SugarApplication = new SugarApplication(); |
|
| 173 | - $SugarApplication->controller = new SugarController(); |
|
| 172 | + $SugarApplication = new SugarApplication(); |
|
| 173 | + $SugarApplication->controller = new SugarController(); |
|
| 174 | 174 | |
| 175 | - try { |
|
| 176 | - $SugarApplication->loadLanguages(); |
|
| 175 | + try { |
|
| 176 | + $SugarApplication->loadLanguages(); |
|
| 177 | 177 | |
| 178 | - //check that method call got the current_language global variable set. |
|
| 179 | - $this->assertTrue(isset($GLOBALS['current_language'] )); |
|
| 178 | + //check that method call got the current_language global variable set. |
|
| 179 | + $this->assertTrue(isset($GLOBALS['current_language'] )); |
|
| 180 | 180 | |
| 181 | - //check that method call got the app_strings global variable set. |
|
| 182 | - $this->assertTrue(is_array($GLOBALS['app_strings']) && count($GLOBALS['app_strings']) > 0 ); |
|
| 181 | + //check that method call got the app_strings global variable set. |
|
| 182 | + $this->assertTrue(is_array($GLOBALS['app_strings']) && count($GLOBALS['app_strings']) > 0 ); |
|
| 183 | 183 | |
| 184 | - //check that method call got the app_list_strings global variable set. |
|
| 185 | - $this->assertTrue(is_array($GLOBALS['app_list_strings']) && count($GLOBALS['app_list_strings']) > 0 ); |
|
| 184 | + //check that method call got the app_list_strings global variable set. |
|
| 185 | + $this->assertTrue(is_array($GLOBALS['app_list_strings']) && count($GLOBALS['app_list_strings']) > 0 ); |
|
| 186 | 186 | |
| 187 | - //check that method call got the mod_strings global variable set. |
|
| 188 | - $this->assertTrue(is_array($GLOBALS['mod_strings']) && count($GLOBALS['mod_strings']) > 0 ); |
|
| 187 | + //check that method call got the mod_strings global variable set. |
|
| 188 | + $this->assertTrue(is_array($GLOBALS['mod_strings']) && count($GLOBALS['mod_strings']) > 0 ); |
|
| 189 | 189 | |
| 190 | - } |
|
| 191 | - catch (Exception $e) { |
|
| 192 | - $this->fail(); |
|
| 193 | - } |
|
| 190 | + } |
|
| 191 | + catch (Exception $e) { |
|
| 192 | + $this->fail(); |
|
| 193 | + } |
|
| 194 | 194 | |
| 195 | - } |
|
| 195 | + } |
|
| 196 | 196 | |
| 197 | - public function testcheckDatabaseVersion() |
|
| 198 | - { |
|
| 199 | - error_reporting(E_ERROR | E_PARSE); |
|
| 197 | + public function testcheckDatabaseVersion() |
|
| 198 | + { |
|
| 199 | + error_reporting(E_ERROR | E_PARSE); |
|
| 200 | 200 | |
| 201 | - $SugarApplication = new SugarApplication(); |
|
| 201 | + $SugarApplication = new SugarApplication(); |
|
| 202 | 202 | |
| 203 | - //execute the method with false parameter and check for false returned as it cannot connect to DB. |
|
| 204 | - //testing with true will allow it to use die() which stops phpunit execution as well. |
|
| 205 | - $result = $SugarApplication->checkDatabaseVersion(false); |
|
| 206 | - $this->assertFalse($result); |
|
| 203 | + //execute the method with false parameter and check for false returned as it cannot connect to DB. |
|
| 204 | + //testing with true will allow it to use die() which stops phpunit execution as well. |
|
| 205 | + $result = $SugarApplication->checkDatabaseVersion(false); |
|
| 206 | + $this->assertFalse($result); |
|
| 207 | 207 | |
| 208 | - } |
|
| 208 | + } |
|
| 209 | 209 | |
| 210 | 210 | |
| 211 | - public function testloadDisplaySettings(){ |
|
| 211 | + public function testloadDisplaySettings(){ |
|
| 212 | 212 | |
| 213 | - $SugarApplication = new SugarApplication(); |
|
| 213 | + $SugarApplication = new SugarApplication(); |
|
| 214 | 214 | |
| 215 | - //execute the method and test if it works and does not throws an exception. |
|
| 216 | - try { |
|
| 217 | - $SugarApplication->loadDisplaySettings(); |
|
| 218 | - } |
|
| 219 | - catch (Exception $e) { |
|
| 220 | - $this->fail(); |
|
| 221 | - } |
|
| 215 | + //execute the method and test if it works and does not throws an exception. |
|
| 216 | + try { |
|
| 217 | + $SugarApplication->loadDisplaySettings(); |
|
| 218 | + } |
|
| 219 | + catch (Exception $e) { |
|
| 220 | + $this->fail(); |
|
| 221 | + } |
|
| 222 | 222 | |
| 223 | - $this->assertTrue(TRUE); |
|
| 223 | + $this->assertTrue(TRUE); |
|
| 224 | 224 | |
| 225 | - } |
|
| 225 | + } |
|
| 226 | 226 | |
| 227 | - public function testloadLicense(){ |
|
| 227 | + public function testloadLicense(){ |
|
| 228 | 228 | |
| 229 | - $SugarApplication = new SugarApplication(); |
|
| 229 | + $SugarApplication = new SugarApplication(); |
|
| 230 | 230 | |
| 231 | - //execute the method and test if it works and does not throws an exception. |
|
| 232 | - try { |
|
| 233 | - $SugarApplication->loadLicense(); |
|
| 231 | + //execute the method and test if it works and does not throws an exception. |
|
| 232 | + try { |
|
| 233 | + $SugarApplication->loadLicense(); |
|
| 234 | 234 | |
| 235 | - } |
|
| 236 | - catch (Exception $e) { |
|
| 237 | - $this->fail(); |
|
| 238 | - } |
|
| 235 | + } |
|
| 236 | + catch (Exception $e) { |
|
| 237 | + $this->fail(); |
|
| 238 | + } |
|
| 239 | 239 | |
| 240 | - $this->assertTrue(TRUE); |
|
| 240 | + $this->assertTrue(TRUE); |
|
| 241 | 241 | |
| 242 | - } |
|
| 242 | + } |
|
| 243 | 243 | |
| 244 | - public function testloadGlobals(){ |
|
| 244 | + public function testloadGlobals(){ |
|
| 245 | 245 | |
| 246 | - $SugarApplication = new SugarApplication(); |
|
| 247 | - $SugarApplication->controller = new SugarController(); |
|
| 246 | + $SugarApplication = new SugarApplication(); |
|
| 247 | + $SugarApplication->controller = new SugarController(); |
|
| 248 | 248 | |
| 249 | - //execute the method and test if it works and does not throws an exception. |
|
| 250 | - try { |
|
| 251 | - $SugarApplication->loadGlobals(); |
|
| 249 | + //execute the method and test if it works and does not throws an exception. |
|
| 250 | + try { |
|
| 251 | + $SugarApplication->loadGlobals(); |
|
| 252 | 252 | |
| 253 | - } |
|
| 254 | - catch (Exception $e) { |
|
| 255 | - $this->fail(); |
|
| 256 | - } |
|
| 253 | + } |
|
| 254 | + catch (Exception $e) { |
|
| 255 | + $this->fail(); |
|
| 256 | + } |
|
| 257 | 257 | |
| 258 | - $this->assertTrue(TRUE); |
|
| 258 | + $this->assertTrue(TRUE); |
|
| 259 | 259 | |
| 260 | - } |
|
| 260 | + } |
|
| 261 | 261 | |
| 262 | 262 | |
| 263 | - public function teststartSession(){ |
|
| 263 | + public function teststartSession(){ |
|
| 264 | 264 | |
| 265 | - $SugarApplication = new SugarApplication(); |
|
| 266 | - $SugarApplication->controller = new SugarController(); |
|
| 265 | + $SugarApplication = new SugarApplication(); |
|
| 266 | + $SugarApplication->controller = new SugarController(); |
|
| 267 | 267 | |
| 268 | - //execute the method and test if it works and does not throws an exception. |
|
| 269 | - try { |
|
| 270 | - $SugarApplication->startSession(); |
|
| 271 | - } |
|
| 272 | - catch (Exception $e) { |
|
| 273 | - $this->fail(); |
|
| 274 | - } |
|
| 268 | + //execute the method and test if it works and does not throws an exception. |
|
| 269 | + try { |
|
| 270 | + $SugarApplication->startSession(); |
|
| 271 | + } |
|
| 272 | + catch (Exception $e) { |
|
| 273 | + $this->fail(); |
|
| 274 | + } |
|
| 275 | 275 | |
| 276 | - $this->assertTrue(TRUE); |
|
| 276 | + $this->assertTrue(TRUE); |
|
| 277 | 277 | |
| 278 | 278 | |
| 279 | - } |
|
| 279 | + } |
|
| 280 | 280 | |
| 281 | 281 | |
| 282 | - public function testendSession(){ |
|
| 282 | + public function testendSession(){ |
|
| 283 | 283 | |
| 284 | 284 | |
| 285 | - $SugarApplication = new SugarApplication(); |
|
| 286 | - $SugarApplication->controller = new SugarController(); |
|
| 285 | + $SugarApplication = new SugarApplication(); |
|
| 286 | + $SugarApplication->controller = new SugarController(); |
|
| 287 | 287 | |
| 288 | - //execute the method and test if it works and does not throws an exception. |
|
| 289 | - try { |
|
| 290 | - $SugarApplication->endSession(); |
|
| 291 | - } |
|
| 292 | - catch (Exception $e) { |
|
| 293 | - $this->fail(); |
|
| 294 | - } |
|
| 288 | + //execute the method and test if it works and does not throws an exception. |
|
| 289 | + try { |
|
| 290 | + $SugarApplication->endSession(); |
|
| 291 | + } |
|
| 292 | + catch (Exception $e) { |
|
| 293 | + $this->fail(); |
|
| 294 | + } |
|
| 295 | 295 | |
| 296 | - $this->assertTrue(TRUE); |
|
| 296 | + $this->assertTrue(TRUE); |
|
| 297 | 297 | |
| 298 | - } |
|
| 298 | + } |
|
| 299 | 299 | |
| 300 | - public function testredirect() |
|
| 301 | - { |
|
| 302 | - //this method uses exit() which stops execution of phpunit as well so it cannot be tested without additional --process-isolation commandline parameter. |
|
| 303 | - /* |
|
| 300 | + public function testredirect() |
|
| 301 | + { |
|
| 302 | + //this method uses exit() which stops execution of phpunit as well so it cannot be tested without additional --process-isolation commandline parameter. |
|
| 303 | + /* |
|
| 304 | 304 | $SugarApplication = new SugarApplication(); |
| 305 | 305 | |
| 306 | 306 | //execute the method and check if it works and doesn't throws an exception |
@@ -317,75 +317,75 @@ discard block |
||
| 317 | 317 | $this->fail(); |
| 318 | 318 | } |
| 319 | 319 | */ |
| 320 | - $this->markTestIncomplete('Can Not be implemented'); |
|
| 320 | + $this->markTestIncomplete('Can Not be implemented'); |
|
| 321 | 321 | |
| 322 | - } |
|
| 322 | + } |
|
| 323 | 323 | |
| 324 | 324 | |
| 325 | - public function testappendErrorMessage() |
|
| 326 | - { |
|
| 327 | - //execute the method and check that the method adds the message to user_error_message array. |
|
| 328 | - //there should be one more array element after method execution. |
|
| 329 | - $user_error_message_count = count($_SESSION['user_error_message']); |
|
| 330 | - SugarApplication::appendErrorMessage('some error'); |
|
| 331 | - $this->assertGreaterThan($user_error_message_count , count($_SESSION['user_error_message'])); |
|
| 332 | - } |
|
| 325 | + public function testappendErrorMessage() |
|
| 326 | + { |
|
| 327 | + //execute the method and check that the method adds the message to user_error_message array. |
|
| 328 | + //there should be one more array element after method execution. |
|
| 329 | + $user_error_message_count = count($_SESSION['user_error_message']); |
|
| 330 | + SugarApplication::appendErrorMessage('some error'); |
|
| 331 | + $this->assertGreaterThan($user_error_message_count , count($_SESSION['user_error_message'])); |
|
| 332 | + } |
|
| 333 | 333 | |
| 334 | 334 | public function testgetErrorMessages() |
| 335 | - { |
|
| 336 | - //execute the method and check if it returns a array. |
|
| 337 | - $errorMessages = SugarApplication::getErrorMessages(); |
|
| 338 | - $this->assertTrue(is_array($errorMessages)); |
|
| 335 | + { |
|
| 336 | + //execute the method and check if it returns a array. |
|
| 337 | + $errorMessages = SugarApplication::getErrorMessages(); |
|
| 338 | + $this->assertTrue(is_array($errorMessages)); |
|
| 339 | 339 | |
| 340 | - } |
|
| 340 | + } |
|
| 341 | 341 | |
| 342 | 342 | |
| 343 | - public function testsetCookie( ) |
|
| 344 | - { |
|
| 345 | - //execute the method and check that the method adds the key value pair to cookies array. |
|
| 346 | - SugarApplication::setCookie('key','value'); |
|
| 347 | - $this->assertEquals('value' , $_COOKIE['key'] ); |
|
| 343 | + public function testsetCookie( ) |
|
| 344 | + { |
|
| 345 | + //execute the method and check that the method adds the key value pair to cookies array. |
|
| 346 | + SugarApplication::setCookie('key','value'); |
|
| 347 | + $this->assertEquals('value' , $_COOKIE['key'] ); |
|
| 348 | 348 | |
| 349 | - } |
|
| 349 | + } |
|
| 350 | 350 | |
| 351 | 351 | |
| 352 | - public function testcreateLoginVars() |
|
| 353 | - { |
|
| 352 | + public function testcreateLoginVars() |
|
| 353 | + { |
|
| 354 | 354 | |
| 355 | - $SugarApplication = new SugarApplication(); |
|
| 355 | + $SugarApplication = new SugarApplication(); |
|
| 356 | 356 | |
| 357 | - //execute the method and test if it works and does not throws an exception. |
|
| 358 | - try { |
|
| 359 | - $vars = $SugarApplication->createLoginVars(); |
|
| 360 | - } |
|
| 361 | - catch (Exception $e) { |
|
| 362 | - $this->fail(); |
|
| 363 | - } |
|
| 357 | + //execute the method and test if it works and does not throws an exception. |
|
| 358 | + try { |
|
| 359 | + $vars = $SugarApplication->createLoginVars(); |
|
| 360 | + } |
|
| 361 | + catch (Exception $e) { |
|
| 362 | + $this->fail(); |
|
| 363 | + } |
|
| 364 | 364 | |
| 365 | - $this->assertTrue(TRUE); |
|
| 365 | + $this->assertTrue(TRUE); |
|
| 366 | 366 | |
| 367 | - } |
|
| 367 | + } |
|
| 368 | 368 | |
| 369 | 369 | |
| 370 | - public function testgetLoginVars() |
|
| 371 | - { |
|
| 372 | - $SugarApplication = new SugarApplication(); |
|
| 370 | + public function testgetLoginVars() |
|
| 371 | + { |
|
| 372 | + $SugarApplication = new SugarApplication(); |
|
| 373 | 373 | |
| 374 | - //execute the method and test that it returns a array. |
|
| 375 | - $vars = $SugarApplication->getLoginVars(); |
|
| 376 | - $this->assertTrue(is_array($vars)); |
|
| 374 | + //execute the method and test that it returns a array. |
|
| 375 | + $vars = $SugarApplication->getLoginVars(); |
|
| 376 | + $this->assertTrue(is_array($vars)); |
|
| 377 | 377 | |
| 378 | - } |
|
| 378 | + } |
|
| 379 | 379 | |
| 380 | 380 | |
| 381 | - public function testgetLoginRedirect() |
|
| 382 | - { |
|
| 381 | + public function testgetLoginRedirect() |
|
| 382 | + { |
|
| 383 | 383 | |
| 384 | - $SugarApplication = new SugarApplication(); |
|
| 384 | + $SugarApplication = new SugarApplication(); |
|
| 385 | 385 | |
| 386 | - //execute the method and test that it returns a plus length string |
|
| 387 | - $redirect = $SugarApplication->getLoginRedirect(); |
|
| 388 | - $this->assertGreaterThan(0, strlen($redirect)); |
|
| 386 | + //execute the method and test that it returns a plus length string |
|
| 387 | + $redirect = $SugarApplication->getLoginRedirect(); |
|
| 388 | + $this->assertGreaterThan(0, strlen($redirect)); |
|
| 389 | 389 | |
| 390 | - } |
|
| 390 | + } |
|
| 391 | 391 | } |
@@ -6,18 +6,18 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | public function testinit() |
| 8 | 8 | { |
| 9 | - error_reporting(E_ERROR | E_WARNING | E_PARSE); |
|
| 9 | + error_reporting(E_ERROR | E_WARNING | E_PARSE); |
|
| 10 | 10 | |
| 11 | - $SugarView = new SugarView(); |
|
| 11 | + $SugarView = new SugarView(); |
|
| 12 | 12 | |
| 13 | - //execute the method and check if it works and doesn't throws an exception |
|
| 14 | - try { |
|
| 15 | - $SugarView->init(); |
|
| 16 | - } catch (Exception $e) { |
|
| 17 | - $this->fail(); |
|
| 18 | - } |
|
| 13 | + //execute the method and check if it works and doesn't throws an exception |
|
| 14 | + try { |
|
| 15 | + $SugarView->init(); |
|
| 16 | + } catch (Exception $e) { |
|
| 17 | + $this->fail(); |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - $this->assertTrue(TRUE); |
|
| 20 | + $this->assertTrue(TRUE); |
|
| 21 | 21 | |
| 22 | 22 | |
| 23 | 23 | } |
@@ -26,43 +26,43 @@ discard block |
||
| 26 | 26 | public function testprocess() |
| 27 | 27 | { |
| 28 | 28 | |
| 29 | - $SugarView = new SugarView(); |
|
| 30 | - $SugarView->module = "Users"; |
|
| 31 | - $GLOBALS['app'] = new SugarApplication(); |
|
| 29 | + $SugarView = new SugarView(); |
|
| 30 | + $SugarView->module = "Users"; |
|
| 31 | + $GLOBALS['app'] = new SugarApplication(); |
|
| 32 | 32 | |
| 33 | - //execute the method and check if it works and doesn't throws an exception |
|
| 34 | - //secondly check if it outputs any content to browser |
|
| 35 | - try { |
|
| 33 | + //execute the method and check if it works and doesn't throws an exception |
|
| 34 | + //secondly check if it outputs any content to browser |
|
| 35 | + try { |
|
| 36 | 36 | |
| 37 | - ob_start(); |
|
| 37 | + ob_start(); |
|
| 38 | 38 | |
| 39 | - $SugarView->process(); |
|
| 39 | + $SugarView->process(); |
|
| 40 | 40 | |
| 41 | - $renderedContent = ob_get_contents(); |
|
| 42 | - ob_end_clean(); |
|
| 41 | + $renderedContent = ob_get_contents(); |
|
| 42 | + ob_end_clean(); |
|
| 43 | 43 | |
| 44 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
| 44 | + $this->assertGreaterThan(0,strlen($renderedContent)); |
|
| 45 | 45 | |
| 46 | - } catch (Exception $e) { |
|
| 47 | - $this->fail(); |
|
| 48 | - } |
|
| 46 | + } catch (Exception $e) { |
|
| 47 | + $this->fail(); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | public function testdisplayErrors() |
| 54 | 54 | { |
| 55 | - $SugarView = new SugarView(); |
|
| 55 | + $SugarView = new SugarView(); |
|
| 56 | 56 | |
| 57 | - //execute the method and check if it works and doesn't throws an exception |
|
| 58 | - try { |
|
| 59 | - $errors = $SugarView->displayErrors(); |
|
| 60 | - $this->assertSame(NULL,$errors); |
|
| 61 | - } catch (Exception $e) { |
|
| 62 | - $this->fail(); |
|
| 63 | - } |
|
| 57 | + //execute the method and check if it works and doesn't throws an exception |
|
| 58 | + try { |
|
| 59 | + $errors = $SugarView->displayErrors(); |
|
| 60 | + $this->assertSame(NULL,$errors); |
|
| 61 | + } catch (Exception $e) { |
|
| 62 | + $this->fail(); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - $this->assertTrue(TRUE); |
|
| 65 | + $this->assertTrue(TRUE); |
|
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | |
@@ -71,17 +71,17 @@ discard block |
||
| 71 | 71 | public function testpreDisplay() |
| 72 | 72 | { |
| 73 | 73 | |
| 74 | - $SugarView = new SugarView(); |
|
| 74 | + $SugarView = new SugarView(); |
|
| 75 | 75 | |
| 76 | - //execute the method and check if it works and doesn't throws an exception |
|
| 77 | - try { |
|
| 78 | - $SugarView->preDisplay(); |
|
| 76 | + //execute the method and check if it works and doesn't throws an exception |
|
| 77 | + try { |
|
| 78 | + $SugarView->preDisplay(); |
|
| 79 | 79 | |
| 80 | - } catch (Exception $e) { |
|
| 81 | - $this->fail(); |
|
| 82 | - } |
|
| 80 | + } catch (Exception $e) { |
|
| 81 | + $this->fail(); |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - $this->assertTrue(TRUE); |
|
| 84 | + $this->assertTrue(TRUE); |
|
| 85 | 85 | |
| 86 | 86 | |
| 87 | 87 | } |
@@ -90,76 +90,76 @@ discard block |
||
| 90 | 90 | public function testdisplay() |
| 91 | 91 | { |
| 92 | 92 | |
| 93 | - $SugarView = new SugarView(); |
|
| 93 | + $SugarView = new SugarView(); |
|
| 94 | 94 | |
| 95 | - //execute the method and check if it works and doesn't throws an exception |
|
| 96 | - try { |
|
| 97 | - $SugarView->display(); |
|
| 95 | + //execute the method and check if it works and doesn't throws an exception |
|
| 96 | + try { |
|
| 97 | + $SugarView->display(); |
|
| 98 | 98 | |
| 99 | - } catch (Exception $e) { |
|
| 100 | - $this->fail(); |
|
| 101 | - } |
|
| 99 | + } catch (Exception $e) { |
|
| 100 | + $this->fail(); |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - $this->assertTrue(TRUE); |
|
| 103 | + $this->assertTrue(TRUE); |
|
| 104 | 104 | |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | public function testdisplayHeader() |
| 108 | 108 | { |
| 109 | 109 | |
| 110 | - $SugarView = new SugarView(); |
|
| 111 | - $SugarView->module = "Users"; |
|
| 112 | - $GLOBALS['app'] = new SugarApplication(); |
|
| 110 | + $SugarView = new SugarView(); |
|
| 111 | + $SugarView->module = "Users"; |
|
| 112 | + $GLOBALS['app'] = new SugarApplication(); |
|
| 113 | 113 | |
| 114 | - //execute the method and check if it works and doesn't throws an exception |
|
| 115 | - //secondly check if it outputs any content to browser |
|
| 116 | - try { |
|
| 117 | - ob_start(); |
|
| 114 | + //execute the method and check if it works and doesn't throws an exception |
|
| 115 | + //secondly check if it outputs any content to browser |
|
| 116 | + try { |
|
| 117 | + ob_start(); |
|
| 118 | 118 | |
| 119 | - $SugarView->displayHeader(); |
|
| 119 | + $SugarView->displayHeader(); |
|
| 120 | 120 | |
| 121 | - $renderedContent = ob_get_contents(); |
|
| 122 | - ob_end_clean(); |
|
| 121 | + $renderedContent = ob_get_contents(); |
|
| 122 | + ob_end_clean(); |
|
| 123 | 123 | |
| 124 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
| 124 | + $this->assertGreaterThan(0,strlen($renderedContent)); |
|
| 125 | 125 | |
| 126 | - } catch (Exception $e) { |
|
| 127 | - $this->fail(); |
|
| 128 | - } |
|
| 126 | + } catch (Exception $e) { |
|
| 127 | + $this->fail(); |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | function testgetModuleMenuHTML() |
| 133 | 133 | { |
| 134 | - $SugarView = new SugarView(); |
|
| 134 | + $SugarView = new SugarView(); |
|
| 135 | 135 | |
| 136 | - //execute the method and check if it works and doesn't throws an exception |
|
| 137 | - try { |
|
| 138 | - $SugarView->getModuleMenuHTML(); |
|
| 136 | + //execute the method and check if it works and doesn't throws an exception |
|
| 137 | + try { |
|
| 138 | + $SugarView->getModuleMenuHTML(); |
|
| 139 | 139 | |
| 140 | - } catch (Exception $e) { |
|
| 141 | - $this->fail(); |
|
| 142 | - } |
|
| 140 | + } catch (Exception $e) { |
|
| 141 | + $this->fail(); |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | - $this->assertTrue(TRUE); |
|
| 144 | + $this->assertTrue(TRUE); |
|
| 145 | 145 | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | |
| 149 | 149 | public function testincludeClassicFile() |
| 150 | 150 | { |
| 151 | - $SugarView = new SugarView(); |
|
| 151 | + $SugarView = new SugarView(); |
|
| 152 | 152 | |
| 153 | - //execute the method and check if it works and doesn't throws an exception |
|
| 154 | - //use any valid file path, we just need to avoid failing require_once |
|
| 155 | - try { |
|
| 156 | - $SugarView->includeClassicFile('config.php'); |
|
| 153 | + //execute the method and check if it works and doesn't throws an exception |
|
| 154 | + //use any valid file path, we just need to avoid failing require_once |
|
| 155 | + try { |
|
| 156 | + $SugarView->includeClassicFile('config.php'); |
|
| 157 | 157 | |
| 158 | - } catch (Exception $e) { |
|
| 159 | - $this->fail(); |
|
| 160 | - } |
|
| 158 | + } catch (Exception $e) { |
|
| 159 | + $this->fail(); |
|
| 160 | + } |
|
| 161 | 161 | |
| 162 | - $this->assertTrue(TRUE); |
|
| 162 | + $this->assertTrue(TRUE); |
|
| 163 | 163 | |
| 164 | 164 | } |
| 165 | 165 | |
@@ -167,32 +167,32 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | public function testgetJavascriptValidation() |
| 169 | 169 | { |
| 170 | - //check if it returns any text i-e JS code |
|
| 171 | - $js = SugarView::getJavascriptValidation(); |
|
| 172 | - $this->assertGreaterThan(0,strlen($js)); |
|
| 170 | + //check if it returns any text i-e JS code |
|
| 171 | + $js = SugarView::getJavascriptValidation(); |
|
| 172 | + $this->assertGreaterThan(0,strlen($js)); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | |
| 176 | 176 | public function testdisplayFooter() |
| 177 | 177 | { |
| 178 | 178 | |
| 179 | - $SugarView = new SugarView(); |
|
| 179 | + $SugarView = new SugarView(); |
|
| 180 | 180 | |
| 181 | - //execute the method and check if it works and doesn't throws an exception |
|
| 182 | - //secondly check if it outputs any content to browser |
|
| 183 | - try { |
|
| 184 | - ob_start(); |
|
| 181 | + //execute the method and check if it works and doesn't throws an exception |
|
| 182 | + //secondly check if it outputs any content to browser |
|
| 183 | + try { |
|
| 184 | + ob_start(); |
|
| 185 | 185 | |
| 186 | - $SugarView->displayFooter(); |
|
| 186 | + $SugarView->displayFooter(); |
|
| 187 | 187 | |
| 188 | - $renderedContent = ob_get_contents(); |
|
| 189 | - ob_end_clean(); |
|
| 188 | + $renderedContent = ob_get_contents(); |
|
| 189 | + ob_end_clean(); |
|
| 190 | 190 | |
| 191 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
| 191 | + $this->assertGreaterThan(0,strlen($renderedContent)); |
|
| 192 | 192 | |
| 193 | - } catch (Exception $e) { |
|
| 194 | - $this->fail(); |
|
| 195 | - } |
|
| 193 | + } catch (Exception $e) { |
|
| 194 | + $this->fail(); |
|
| 195 | + } |
|
| 196 | 196 | |
| 197 | 197 | } |
| 198 | 198 | |
@@ -200,23 +200,23 @@ discard block |
||
| 200 | 200 | public function testrenderJavascript() |
| 201 | 201 | { |
| 202 | 202 | |
| 203 | - $SugarView = new SugarView(); |
|
| 203 | + $SugarView = new SugarView(); |
|
| 204 | 204 | |
| 205 | - //execute the method and check if it works and doesn't throws an exception |
|
| 206 | - //secondly check if it outputs any content to browser |
|
| 207 | - try { |
|
| 208 | - ob_start(); |
|
| 205 | + //execute the method and check if it works and doesn't throws an exception |
|
| 206 | + //secondly check if it outputs any content to browser |
|
| 207 | + try { |
|
| 208 | + ob_start(); |
|
| 209 | 209 | |
| 210 | - $SugarView->renderJavascript(); |
|
| 210 | + $SugarView->renderJavascript(); |
|
| 211 | 211 | |
| 212 | - $renderedContent = ob_get_contents(); |
|
| 213 | - ob_end_clean(); |
|
| 212 | + $renderedContent = ob_get_contents(); |
|
| 213 | + ob_end_clean(); |
|
| 214 | 214 | |
| 215 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
| 215 | + $this->assertGreaterThan(0,strlen($renderedContent)); |
|
| 216 | 216 | |
| 217 | - } catch (Exception $e) { |
|
| 218 | - $this->fail(); |
|
| 219 | - } |
|
| 217 | + } catch (Exception $e) { |
|
| 218 | + $this->fail(); |
|
| 219 | + } |
|
| 220 | 220 | |
| 221 | 221 | } |
| 222 | 222 | |
@@ -225,14 +225,14 @@ discard block |
||
| 225 | 225 | public function testgetMenu() |
| 226 | 226 | { |
| 227 | 227 | |
| 228 | - //error_reporting(E_ALL); |
|
| 228 | + //error_reporting(E_ALL); |
|
| 229 | 229 | |
| 230 | - $SugarView = new SugarView(); |
|
| 230 | + $SugarView = new SugarView(); |
|
| 231 | 231 | |
| 232 | 232 | |
| 233 | - //execute the method and check if it works and throws an exception if no module is provided |
|
| 234 | - //it creates memory Fatal errors which causes PHPunit to crash so we will skip this scenario |
|
| 235 | - /* |
|
| 233 | + //execute the method and check if it works and throws an exception if no module is provided |
|
| 234 | + //it creates memory Fatal errors which causes PHPunit to crash so we will skip this scenario |
|
| 235 | + /* |
|
| 236 | 236 | try { |
| 237 | 237 | //check first with invalid value and test if it throws an exception |
| 238 | 238 | $menu = $SugarView->getMenu(); |
@@ -244,28 +244,28 @@ discard block |
||
| 244 | 244 | } */ |
| 245 | 245 | |
| 246 | 246 | |
| 247 | - //check with valid value and check if it returns an array. |
|
| 248 | - $menu = $SugarView->getMenu('Users'); |
|
| 249 | - $this->assertTrue(is_array($menu)); |
|
| 247 | + //check with valid value and check if it returns an array. |
|
| 248 | + $menu = $SugarView->getMenu('Users'); |
|
| 249 | + $this->assertTrue(is_array($menu)); |
|
| 250 | 250 | |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | public function testgetModuleTitle() |
| 254 | 254 | { |
| 255 | 255 | |
| 256 | - $SugarView = new SugarView(); |
|
| 256 | + $SugarView = new SugarView(); |
|
| 257 | 257 | |
| 258 | - //first execute the method with default value |
|
| 259 | - $moduleTitle = $SugarView->getModuleTitle(); |
|
| 260 | - $this->assertGreaterThan(0,strlen($moduleTitle)); |
|
| 258 | + //first execute the method with default value |
|
| 259 | + $moduleTitle = $SugarView->getModuleTitle(); |
|
| 260 | + $this->assertGreaterThan(0,strlen($moduleTitle)); |
|
| 261 | 261 | |
| 262 | - //second execute the method with true value |
|
| 263 | - $moduleTitle = $SugarView->getModuleTitle(true); |
|
| 264 | - $this->assertGreaterThan(0,strlen($moduleTitle)); |
|
| 262 | + //second execute the method with true value |
|
| 263 | + $moduleTitle = $SugarView->getModuleTitle(true); |
|
| 264 | + $this->assertGreaterThan(0,strlen($moduleTitle)); |
|
| 265 | 265 | |
| 266 | - //third execute the method with false value |
|
| 267 | - $moduleTitle = $SugarView->getModuleTitle(false); |
|
| 268 | - $this->assertGreaterThan(0,strlen($moduleTitle)); |
|
| 266 | + //third execute the method with false value |
|
| 267 | + $moduleTitle = $SugarView->getModuleTitle(false); |
|
| 268 | + $this->assertGreaterThan(0,strlen($moduleTitle)); |
|
| 269 | 269 | |
| 270 | 270 | } |
| 271 | 271 | |
@@ -273,19 +273,19 @@ discard block |
||
| 273 | 273 | public function testgetMetaDataFile() |
| 274 | 274 | { |
| 275 | 275 | |
| 276 | - $SugarView = new SugarView(); |
|
| 276 | + $SugarView = new SugarView(); |
|
| 277 | 277 | |
| 278 | - //first execute the method with missing attributes. it should return Null. |
|
| 279 | - $metaDataFile = $SugarView->getMetaDataFile(); |
|
| 280 | - $this->assertEquals(NULL,$metaDataFile); |
|
| 278 | + //first execute the method with missing attributes. it should return Null. |
|
| 279 | + $metaDataFile = $SugarView->getMetaDataFile(); |
|
| 280 | + $this->assertEquals(NULL,$metaDataFile); |
|
| 281 | 281 | |
| 282 | 282 | |
| 283 | - //second execute the method with valid attributes set. it should return a file path string. |
|
| 284 | - $SugarView->type ='detail' ; |
|
| 285 | - $SugarView->module = 'Users'; |
|
| 283 | + //second execute the method with valid attributes set. it should return a file path string. |
|
| 284 | + $SugarView->type ='detail' ; |
|
| 285 | + $SugarView->module = 'Users'; |
|
| 286 | 286 | |
| 287 | - $metaDataFile = $SugarView->getMetaDataFile(); |
|
| 288 | - $this->assertGreaterThan(0,strlen($metaDataFile)); |
|
| 287 | + $metaDataFile = $SugarView->getMetaDataFile(); |
|
| 288 | + $this->assertGreaterThan(0,strlen($metaDataFile)); |
|
| 289 | 289 | |
| 290 | 290 | } |
| 291 | 291 | |
@@ -294,11 +294,11 @@ discard block |
||
| 294 | 294 | public function testgetBrowserTitle() |
| 295 | 295 | { |
| 296 | 296 | |
| 297 | - $SugarView = new SugarView(); |
|
| 297 | + $SugarView = new SugarView(); |
|
| 298 | 298 | |
| 299 | - //execute the method. it should return a title string. |
|
| 300 | - $browserTitle = $SugarView->getBrowserTitle(); |
|
| 301 | - $this->assertGreaterThan(0,strlen($browserTitle)); |
|
| 299 | + //execute the method. it should return a title string. |
|
| 300 | + $browserTitle = $SugarView->getBrowserTitle(); |
|
| 301 | + $this->assertGreaterThan(0,strlen($browserTitle)); |
|
| 302 | 302 | |
| 303 | 303 | } |
| 304 | 304 | |
@@ -306,22 +306,22 @@ discard block |
||
| 306 | 306 | public function testgetBreadCrumbSymbol() |
| 307 | 307 | { |
| 308 | 308 | |
| 309 | - $SugarView = new SugarView(); |
|
| 309 | + $SugarView = new SugarView(); |
|
| 310 | 310 | |
| 311 | - //execute the method. it should return a string. |
|
| 312 | - $breadCrumbSymbol = $SugarView->getBreadCrumbSymbol(); |
|
| 313 | - $this->assertGreaterThan(0,strlen($breadCrumbSymbol)); |
|
| 311 | + //execute the method. it should return a string. |
|
| 312 | + $breadCrumbSymbol = $SugarView->getBreadCrumbSymbol(); |
|
| 313 | + $this->assertGreaterThan(0,strlen($breadCrumbSymbol)); |
|
| 314 | 314 | |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | |
| 318 | 318 | public function testcheckPostMaxSizeError(){ |
| 319 | 319 | |
| 320 | - $SugarView = new SugarView(); |
|
| 320 | + $SugarView = new SugarView(); |
|
| 321 | 321 | |
| 322 | - //execute the method. it should return False because Request parameters are not available. |
|
| 323 | - $postMaxSizeError = $SugarView->checkPostMaxSizeError(); |
|
| 324 | - $this->assertFalse($postMaxSizeError); |
|
| 322 | + //execute the method. it should return False because Request parameters are not available. |
|
| 323 | + $postMaxSizeError = $SugarView->checkPostMaxSizeError(); |
|
| 324 | + $this->assertFalse($postMaxSizeError); |
|
| 325 | 325 | |
| 326 | 326 | } |
| 327 | 327 | |
@@ -4,76 +4,76 @@ |
||
| 4 | 4 | |
| 5 | 5 | class ViewFactoryTest extends PHPUnit_Framework_TestCase{ |
| 6 | 6 | |
| 7 | - public function testloadView(){ |
|
| 8 | - error_reporting(E_ERROR | E_WARNING | E_PARSE); |
|
| 7 | + public function testloadView(){ |
|
| 8 | + error_reporting(E_ERROR | E_WARNING | E_PARSE); |
|
| 9 | 9 | |
| 10 | - //check with invalid input. must return sugaview instance |
|
| 11 | - $view = ViewFactory::loadView('default',''); |
|
| 12 | - $this->assertInstanceOf('SugarView',$view); |
|
| 10 | + //check with invalid input. must return sugaview instance |
|
| 11 | + $view = ViewFactory::loadView('default',''); |
|
| 12 | + $this->assertInstanceOf('SugarView',$view); |
|
| 13 | 13 | |
| 14 | - //check with a valid module without a specific view, must return sugarview instance |
|
| 15 | - $view = ViewFactory::loadView('default','Users'); |
|
| 16 | - $this->assertInstanceOf('SugarView',$view); |
|
| 14 | + //check with a valid module without a specific view, must return sugarview instance |
|
| 15 | + $view = ViewFactory::loadView('default','Users'); |
|
| 16 | + $this->assertInstanceOf('SugarView',$view); |
|
| 17 | 17 | |
| 18 | - //check with a valid module and specific view, must reutern speciifc view instance |
|
| 19 | - $view = ViewFactory::loadView('list','Users'); |
|
| 20 | - $this->assertInstanceOf('UsersViewList',$view); |
|
| 18 | + //check with a valid module and specific view, must reutern speciifc view instance |
|
| 19 | + $view = ViewFactory::loadView('list','Users'); |
|
| 20 | + $this->assertInstanceOf('UsersViewList',$view); |
|
| 21 | 21 | |
| 22 | - } |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - public function test_loadConfig(){ |
|
| 25 | - //check with a invalid module, method must not change the view options. |
|
| 26 | - $view = ViewFactory::loadView('default',''); |
|
| 27 | - $options = $view->options; |
|
| 28 | - ViewFactory::_loadConfig($view, 'default'); |
|
| 29 | - $this->assertSame($options,$view->options); |
|
| 24 | + public function test_loadConfig(){ |
|
| 25 | + //check with a invalid module, method must not change the view options. |
|
| 26 | + $view = ViewFactory::loadView('default',''); |
|
| 27 | + $options = $view->options; |
|
| 28 | + ViewFactory::_loadConfig($view, 'default'); |
|
| 29 | + $this->assertSame($options,$view->options); |
|
| 30 | 30 | |
| 31 | 31 | |
| 32 | - //check with a valid module which does not implement it's own view config. method must not change the view options. |
|
| 33 | - $view = ViewFactory::loadView('detail','Users'); |
|
| 34 | - $options = $view->options; |
|
| 35 | - ViewFactory::_loadConfig($view, 'detail'); |
|
| 36 | - $this->assertSame($options,$view->options); |
|
| 32 | + //check with a valid module which does not implement it's own view config. method must not change the view options. |
|
| 33 | + $view = ViewFactory::loadView('detail','Users'); |
|
| 34 | + $options = $view->options; |
|
| 35 | + ViewFactory::_loadConfig($view, 'detail'); |
|
| 36 | + $this->assertSame($options,$view->options); |
|
| 37 | 37 | |
| 38 | 38 | |
| 39 | - //check with a valid module which implement it's own view config. method still must not change the view options because it needs. |
|
| 40 | - $view = ViewFactory::loadView('area_detail_map','jjwg_Areas'); |
|
| 41 | - $view->module = 'jjwg_Areas'; |
|
| 42 | - $options = $view->options; |
|
| 43 | - ViewFactory::_loadConfig($view, 'area_detail_map'); |
|
| 44 | - $this->assertSame($options,$view->options); |
|
| 39 | + //check with a valid module which implement it's own view config. method still must not change the view options because it needs. |
|
| 40 | + $view = ViewFactory::loadView('area_detail_map','jjwg_Areas'); |
|
| 41 | + $view->module = 'jjwg_Areas'; |
|
| 42 | + $options = $view->options; |
|
| 43 | + ViewFactory::_loadConfig($view, 'area_detail_map'); |
|
| 44 | + $this->assertSame($options,$view->options); |
|
| 45 | 45 | |
| 46 | 46 | |
| 47 | - } |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - public function test_buildFromFile(){ |
|
| 49 | + public function test_buildFromFile(){ |
|
| 50 | 50 | |
| 51 | - //checck with valid values and test if it returns correct view instance |
|
| 52 | - $type = 'list'; |
|
| 53 | - $target_module = 'Users'; |
|
| 54 | - $bean = Null; |
|
| 55 | - $view = ViewFactory::_buildFromFile('modules/' . $target_module . '/views/view.'.$type.'.php', $bean, array(), $type, $target_module); |
|
| 56 | - $this->assertInstanceOf('UsersViewList',$view); |
|
| 51 | + //checck with valid values and test if it returns correct view instance |
|
| 52 | + $type = 'list'; |
|
| 53 | + $target_module = 'Users'; |
|
| 54 | + $bean = Null; |
|
| 55 | + $view = ViewFactory::_buildFromFile('modules/' . $target_module . '/views/view.'.$type.'.php', $bean, array(), $type, $target_module); |
|
| 56 | + $this->assertInstanceOf('UsersViewList',$view); |
|
| 57 | 57 | |
| 58 | - //checck with valid values and test if it returns correct view instance |
|
| 59 | - $type = 'detail'; |
|
| 60 | - $target_module = 'Users'; |
|
| 61 | - $bean = Null; |
|
| 62 | - $view = ViewFactory::_buildFromFile('modules/' . $target_module . '/views/view.'.$type.'.php', $bean, array(), $type, $target_module); |
|
| 63 | - $this->assertInstanceOf('UsersViewDetail',$view); |
|
| 58 | + //checck with valid values and test if it returns correct view instance |
|
| 59 | + $type = 'detail'; |
|
| 60 | + $target_module = 'Users'; |
|
| 61 | + $bean = Null; |
|
| 62 | + $view = ViewFactory::_buildFromFile('modules/' . $target_module . '/views/view.'.$type.'.php', $bean, array(), $type, $target_module); |
|
| 63 | + $this->assertInstanceOf('UsersViewDetail',$view); |
|
| 64 | 64 | |
| 65 | - } |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - public function test_buildClass(){ |
|
| 67 | + public function test_buildClass(){ |
|
| 68 | 68 | |
| 69 | - //checck with valid values and test if it returns correct view instance |
|
| 70 | - $view = ViewFactory::_buildClass('UsersViewList', Null, array()); |
|
| 71 | - $this->assertInstanceOf('UsersViewList',$view); |
|
| 69 | + //checck with valid values and test if it returns correct view instance |
|
| 70 | + $view = ViewFactory::_buildClass('UsersViewList', Null, array()); |
|
| 71 | + $this->assertInstanceOf('UsersViewList',$view); |
|
| 72 | 72 | |
| 73 | - //checck with valid values and test if it returns correct view instance |
|
| 74 | - $view = ViewFactory::_buildClass('UsersViewDetail', Null, array()); |
|
| 75 | - $this->assertInstanceOf('UsersViewDetail',$view); |
|
| 73 | + //checck with valid values and test if it returns correct view instance |
|
| 74 | + $view = ViewFactory::_buildClass('UsersViewDetail', Null, array()); |
|
| 75 | + $this->assertInstanceOf('UsersViewDetail',$view); |
|
| 76 | 76 | |
| 77 | - } |
|
| 77 | + } |
|
| 78 | 78 | } |
| 79 | 79 | ?> |
@@ -3,194 +3,194 @@ |
||
| 3 | 3 | class ViewMetadataTest extends PHPUnit_Framework_TestCase |
| 4 | 4 | { |
| 5 | 5 | |
| 6 | - public function testdisplayCheckBoxes(){ |
|
| 6 | + public function testdisplayCheckBoxes(){ |
|
| 7 | 7 | |
| 8 | - $view = new ViewMetadata(); |
|
| 8 | + $view = new ViewMetadata(); |
|
| 9 | 9 | |
| 10 | - //check with empty values array. it should return html sting |
|
| 11 | - ob_start(); |
|
| 12 | - $values = Array(); |
|
| 13 | - $view->displayCheckBoxes('test',$values); |
|
| 14 | - $renderedContent1 = ob_get_contents(); |
|
| 15 | - ob_end_clean(); |
|
| 16 | - $this->assertGreaterThan(0,strlen($renderedContent1)); |
|
| 10 | + //check with empty values array. it should return html sting |
|
| 11 | + ob_start(); |
|
| 12 | + $values = Array(); |
|
| 13 | + $view->displayCheckBoxes('test',$values); |
|
| 14 | + $renderedContent1 = ob_get_contents(); |
|
| 15 | + ob_end_clean(); |
|
| 16 | + $this->assertGreaterThan(0,strlen($renderedContent1)); |
|
| 17 | 17 | |
| 18 | 18 | |
| 19 | - //check with prefilled values array. it should return html sting longer than earlier |
|
| 20 | - ob_start(); |
|
| 21 | - $values = Array('option1','option2'); |
|
| 22 | - $view->displayCheckBoxes('test',$values); |
|
| 23 | - $renderedContent2 = ob_get_contents(); |
|
| 24 | - ob_end_clean(); |
|
| 25 | - $this->assertGreaterThan(strlen($renderedContent1),strlen($renderedContent2)); |
|
| 19 | + //check with prefilled values array. it should return html sting longer than earlier |
|
| 20 | + ob_start(); |
|
| 21 | + $values = Array('option1','option2'); |
|
| 22 | + $view->displayCheckBoxes('test',$values); |
|
| 23 | + $renderedContent2 = ob_get_contents(); |
|
| 24 | + ob_end_clean(); |
|
| 25 | + $this->assertGreaterThan(strlen($renderedContent1),strlen($renderedContent2)); |
|
| 26 | 26 | |
| 27 | - } |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - public function testdisplaySelect(){ |
|
| 29 | + public function testdisplaySelect(){ |
|
| 30 | 30 | |
| 31 | - $view = new ViewMetadata(); |
|
| 31 | + $view = new ViewMetadata(); |
|
| 32 | 32 | |
| 33 | - //check with empty values array. it should return html sting |
|
| 34 | - ob_start(); |
|
| 35 | - $values = Array(); |
|
| 36 | - $view->displaySelect('test',$values); |
|
| 37 | - $renderedContent1 = ob_get_contents(); |
|
| 38 | - ob_end_clean(); |
|
| 39 | - $this->assertGreaterThan(0,strlen($renderedContent1)); |
|
| 33 | + //check with empty values array. it should return html sting |
|
| 34 | + ob_start(); |
|
| 35 | + $values = Array(); |
|
| 36 | + $view->displaySelect('test',$values); |
|
| 37 | + $renderedContent1 = ob_get_contents(); |
|
| 38 | + ob_end_clean(); |
|
| 39 | + $this->assertGreaterThan(0,strlen($renderedContent1)); |
|
| 40 | 40 | |
| 41 | 41 | |
| 42 | - //check with prefilled values array. it should return html sting longer than earlier |
|
| 43 | - ob_start(); |
|
| 44 | - $values = Array('option1','option2'); |
|
| 45 | - $view->displaySelect('test',$values); |
|
| 46 | - $renderedContent2 = ob_get_contents(); |
|
| 47 | - ob_end_clean(); |
|
| 48 | - $this->assertGreaterThan(strlen($renderedContent1),strlen($renderedContent2)); |
|
| 42 | + //check with prefilled values array. it should return html sting longer than earlier |
|
| 43 | + ob_start(); |
|
| 44 | + $values = Array('option1','option2'); |
|
| 45 | + $view->displaySelect('test',$values); |
|
| 46 | + $renderedContent2 = ob_get_contents(); |
|
| 47 | + ob_end_clean(); |
|
| 48 | + $this->assertGreaterThan(strlen($renderedContent1),strlen($renderedContent2)); |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | - } |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | |
| 55 | - public function testdisplayTextBoxes(){ |
|
| 55 | + public function testdisplayTextBoxes(){ |
|
| 56 | 56 | |
| 57 | - $view = new ViewMetadata(); |
|
| 57 | + $view = new ViewMetadata(); |
|
| 58 | 58 | |
| 59 | - //check with empty values array. it should return html sting |
|
| 60 | - ob_start(); |
|
| 61 | - $values = Array(); |
|
| 62 | - $view->displayTextBoxes($values); |
|
| 63 | - $renderedContent1 = ob_get_contents(); |
|
| 64 | - ob_end_clean(); |
|
| 65 | - $this->assertGreaterThan(0,strlen($renderedContent1)); |
|
| 59 | + //check with empty values array. it should return html sting |
|
| 60 | + ob_start(); |
|
| 61 | + $values = Array(); |
|
| 62 | + $view->displayTextBoxes($values); |
|
| 63 | + $renderedContent1 = ob_get_contents(); |
|
| 64 | + ob_end_clean(); |
|
| 65 | + $this->assertGreaterThan(0,strlen($renderedContent1)); |
|
| 66 | 66 | |
| 67 | 67 | |
| 68 | - //check with prefilled values array. it should return html sting longer than earlier |
|
| 69 | - ob_start(); |
|
| 70 | - $values = Array('option1','option2'); |
|
| 71 | - $view->displayTextBoxes($values); |
|
| 72 | - $renderedContent2 = ob_get_contents(); |
|
| 73 | - ob_end_clean(); |
|
| 74 | - $this->assertGreaterThan(strlen($renderedContent1),strlen($renderedContent2)); |
|
| 68 | + //check with prefilled values array. it should return html sting longer than earlier |
|
| 69 | + ob_start(); |
|
| 70 | + $values = Array('option1','option2'); |
|
| 71 | + $view->displayTextBoxes($values); |
|
| 72 | + $renderedContent2 = ob_get_contents(); |
|
| 73 | + ob_end_clean(); |
|
| 74 | + $this->assertGreaterThan(strlen($renderedContent1),strlen($renderedContent2)); |
|
| 75 | 75 | |
| 76 | 76 | |
| 77 | - } |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | 79 | |
| 80 | - public function testprintValue(){ |
|
| 80 | + public function testprintValue(){ |
|
| 81 | 81 | |
| 82 | - $view = new ViewMetadata(); |
|
| 82 | + $view = new ViewMetadata(); |
|
| 83 | 83 | |
| 84 | - ob_start(); |
|
| 85 | - $values = Array('option1','option2'); |
|
| 86 | - $view->printValue($values); |
|
| 87 | - $renderedContent = ob_get_contents(); |
|
| 88 | - ob_end_clean(); |
|
| 89 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
| 84 | + ob_start(); |
|
| 85 | + $values = Array('option1','option2'); |
|
| 86 | + $view->printValue($values); |
|
| 87 | + $renderedContent = ob_get_contents(); |
|
| 88 | + ob_end_clean(); |
|
| 89 | + $this->assertGreaterThan(0,strlen($renderedContent)); |
|
| 90 | 90 | |
| 91 | - } |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - public function testdisplay(){ |
|
| 94 | - error_reporting(E_ERROR | E_PARSE); |
|
| 93 | + public function testdisplay(){ |
|
| 94 | + error_reporting(E_ERROR | E_PARSE); |
|
| 95 | 95 | |
| 96 | - $view = new ViewMetadata(); |
|
| 96 | + $view = new ViewMetadata(); |
|
| 97 | 97 | |
| 98 | - //test without setting REQUEST parameters |
|
| 99 | - ob_start(); |
|
| 100 | - $view->display(); |
|
| 101 | - $renderedContent = ob_get_contents(); |
|
| 102 | - ob_end_clean(); |
|
| 103 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
| 98 | + //test without setting REQUEST parameters |
|
| 99 | + ob_start(); |
|
| 100 | + $view->display(); |
|
| 101 | + $renderedContent = ob_get_contents(); |
|
| 102 | + ob_end_clean(); |
|
| 103 | + $this->assertGreaterThan(0,strlen($renderedContent)); |
|
| 104 | 104 | |
| 105 | 105 | |
| 106 | - //test with REQUEST parameters set |
|
| 107 | - $_REQUEST['modules'] = Array('Calls','Meetings'); |
|
| 108 | - ob_start(); |
|
| 109 | - $view->display(); |
|
| 110 | - $renderedContent = ob_get_contents(); |
|
| 111 | - ob_end_clean(); |
|
| 112 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
| 106 | + //test with REQUEST parameters set |
|
| 107 | + $_REQUEST['modules'] = Array('Calls','Meetings'); |
|
| 108 | + ob_start(); |
|
| 109 | + $view->display(); |
|
| 110 | + $renderedContent = ob_get_contents(); |
|
| 111 | + ob_end_clean(); |
|
| 112 | + $this->assertGreaterThan(0,strlen($renderedContent)); |
|
| 113 | 113 | |
| 114 | - } |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | 116 | |
| 117 | - public function testgetModules(){ |
|
| 117 | + public function testgetModules(){ |
|
| 118 | 118 | |
| 119 | - //execute the method and test if it returns a array. |
|
| 120 | - $modules = VardefBrowser::getModules(); |
|
| 121 | - $this->assertTrue(is_array($modules)); |
|
| 119 | + //execute the method and test if it returns a array. |
|
| 120 | + $modules = VardefBrowser::getModules(); |
|
| 121 | + $this->assertTrue(is_array($modules)); |
|
| 122 | 122 | |
| 123 | - } |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - public function testfindFieldsWithAttributes(){ |
|
| 125 | + public function testfindFieldsWithAttributes(){ |
|
| 126 | 126 | |
| 127 | - //check with emptty attributes array |
|
| 128 | - $attributes = Array(); |
|
| 129 | - $fields1 = VardefBrowser::findFieldsWithAttributes($attributes); |
|
| 130 | - $this->assertTrue(is_array($fields1)); |
|
| 127 | + //check with emptty attributes array |
|
| 128 | + $attributes = Array(); |
|
| 129 | + $fields1 = VardefBrowser::findFieldsWithAttributes($attributes); |
|
| 130 | + $this->assertTrue(is_array($fields1)); |
|
| 131 | 131 | |
| 132 | - //check with a very common attribute |
|
| 133 | - $attributes = Array('id'); |
|
| 134 | - $fields2 = VardefBrowser::findFieldsWithAttributes($attributes); |
|
| 135 | - $this->assertTrue(is_array($fields2)); |
|
| 132 | + //check with a very common attribute |
|
| 133 | + $attributes = Array('id'); |
|
| 134 | + $fields2 = VardefBrowser::findFieldsWithAttributes($attributes); |
|
| 135 | + $this->assertTrue(is_array($fields2)); |
|
| 136 | 136 | |
| 137 | - //check with a very specific attribute |
|
| 138 | - $attributes = Array('category'); |
|
| 139 | - $fields3 = VardefBrowser::findFieldsWithAttributes($attributes); |
|
| 140 | - $this->assertTrue(is_array($fields3)); |
|
| 137 | + //check with a very specific attribute |
|
| 138 | + $attributes = Array('category'); |
|
| 139 | + $fields3 = VardefBrowser::findFieldsWithAttributes($attributes); |
|
| 140 | + $this->assertTrue(is_array($fields3)); |
|
| 141 | 141 | |
| 142 | - //check that all three arrays returned, are not same. |
|
| 143 | - $this->assertNotSame($fields1,$fields2); |
|
| 144 | - $this->assertNotSame($fields1,$fields3); |
|
| 145 | - $this->assertNotSame($fields2,$fields3); |
|
| 142 | + //check that all three arrays returned, are not same. |
|
| 143 | + $this->assertNotSame($fields1,$fields2); |
|
| 144 | + $this->assertNotSame($fields1,$fields3); |
|
| 145 | + $this->assertNotSame($fields2,$fields3); |
|
| 146 | 146 | |
| 147 | - } |
|
| 147 | + } |
|
| 148 | 148 | |
| 149 | - public function testfindVardefs(){ |
|
| 149 | + public function testfindVardefs(){ |
|
| 150 | 150 | |
| 151 | - //check with empty modules array |
|
| 152 | - $modules = Array(); |
|
| 153 | - $defs1 = VardefBrowser::findVardefs($modules); |
|
| 154 | - $this->assertTrue(is_array($defs1)); |
|
| 151 | + //check with empty modules array |
|
| 152 | + $modules = Array(); |
|
| 153 | + $defs1 = VardefBrowser::findVardefs($modules); |
|
| 154 | + $this->assertTrue(is_array($defs1)); |
|
| 155 | 155 | |
| 156 | 156 | |
| 157 | - //check with modules array set. |
|
| 158 | - $modules = Array('Calls'); |
|
| 159 | - $defs2 = VardefBrowser::findVardefs($modules); |
|
| 160 | - $this->assertTrue(is_array($defs2)); |
|
| 157 | + //check with modules array set. |
|
| 158 | + $modules = Array('Calls'); |
|
| 159 | + $defs2 = VardefBrowser::findVardefs($modules); |
|
| 160 | + $this->assertTrue(is_array($defs2)); |
|
| 161 | 161 | |
| 162 | - //check that two arrays returned, are not same. |
|
| 163 | - $this->assertNotSame($defs1,$defs2); |
|
| 162 | + //check that two arrays returned, are not same. |
|
| 163 | + $this->assertNotSame($defs1,$defs2); |
|
| 164 | 164 | |
| 165 | - } |
|
| 165 | + } |
|
| 166 | 166 | |
| 167 | 167 | |
| 168 | - public function testfindFieldAttributes(){ |
|
| 168 | + public function testfindFieldAttributes(){ |
|
| 169 | 169 | |
| 170 | - //check with emptty attributes array |
|
| 171 | - $attributes = Array(); |
|
| 172 | - $fields1 = VardefBrowser::findFieldAttributes(); |
|
| 173 | - $this->assertTrue(is_array($fields1)); |
|
| 170 | + //check with emptty attributes array |
|
| 171 | + $attributes = Array(); |
|
| 172 | + $fields1 = VardefBrowser::findFieldAttributes(); |
|
| 173 | + $this->assertTrue(is_array($fields1)); |
|
| 174 | 174 | |
| 175 | 175 | |
| 176 | - //check with emptty attributes array and prefilled modules array. |
|
| 177 | - $attributes = Array(); |
|
| 178 | - $modules = Array('Users'); |
|
| 179 | - $fields2 = VardefBrowser::findFieldAttributes($attributes,$modules,true,true); |
|
| 180 | - $this->assertTrue(is_array($fields2)); |
|
| 176 | + //check with emptty attributes array and prefilled modules array. |
|
| 177 | + $attributes = Array(); |
|
| 178 | + $modules = Array('Users'); |
|
| 179 | + $fields2 = VardefBrowser::findFieldAttributes($attributes,$modules,true,true); |
|
| 180 | + $this->assertTrue(is_array($fields2)); |
|
| 181 | 181 | |
| 182 | 182 | |
| 183 | - //check with a very specific attribute and empty modules array. |
|
| 184 | - $attributes = Array('category'); |
|
| 185 | - $fields3 = VardefBrowser::findFieldAttributes($attributes); |
|
| 186 | - $this->assertTrue(is_array($fields3)); |
|
| 183 | + //check with a very specific attribute and empty modules array. |
|
| 184 | + $attributes = Array('category'); |
|
| 185 | + $fields3 = VardefBrowser::findFieldAttributes($attributes); |
|
| 186 | + $this->assertTrue(is_array($fields3)); |
|
| 187 | 187 | |
| 188 | 188 | |
| 189 | - //check that all three arrays returned, are not same. |
|
| 190 | - $this->assertNotSame($fields1,$fields2); |
|
| 191 | - $this->assertNotSame($fields1,$fields3); |
|
| 192 | - $this->assertNotSame($fields2,$fields3); |
|
| 189 | + //check that all three arrays returned, are not same. |
|
| 190 | + $this->assertNotSame($fields1,$fields2); |
|
| 191 | + $this->assertNotSame($fields1,$fields3); |
|
| 192 | + $this->assertNotSame($fields2,$fields3); |
|
| 193 | 193 | |
| 194 | - } |
|
| 194 | + } |
|
| 195 | 195 | |
| 196 | 196 | } |
@@ -3,28 +3,28 @@ |
||
| 3 | 3 | class ViewAjaxUITest extends PHPUnit_Framework_TestCase |
| 4 | 4 | { |
| 5 | 5 | |
| 6 | - public function test__construct() |
|
| 7 | - { |
|
| 8 | - //execute the contructor and check for the Object type and type attribute |
|
| 9 | - $view = new ViewAjaxUI(); |
|
| 10 | - $this->assertInstanceOf('ViewAjaxUI',$view); |
|
| 11 | - $this->assertInstanceOf('SugarView',$view); |
|
| 12 | - $this->assertTrue( is_array($view->options)); |
|
| 6 | + public function test__construct() |
|
| 7 | + { |
|
| 8 | + //execute the contructor and check for the Object type and type attribute |
|
| 9 | + $view = new ViewAjaxUI(); |
|
| 10 | + $this->assertInstanceOf('ViewAjaxUI',$view); |
|
| 11 | + $this->assertInstanceOf('SugarView',$view); |
|
| 12 | + $this->assertTrue( is_array($view->options)); |
|
| 13 | 13 | |
| 14 | - } |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | 16 | public function testdisplay() |
| 17 | - { |
|
| 17 | + { |
|
| 18 | 18 | |
| 19 | - $view = new ViewAjaxUI(); |
|
| 19 | + $view = new ViewAjaxUI(); |
|
| 20 | 20 | |
| 21 | - //execute the method and test if it works and does not throws an exception other than headers output exception. |
|
| 22 | - try { |
|
| 23 | - $view->display(); |
|
| 21 | + //execute the method and test if it works and does not throws an exception other than headers output exception. |
|
| 22 | + try { |
|
| 23 | + $view->display(); |
|
| 24 | 24 | |
| 25 | - } catch (Exception $e) { |
|
| 26 | - $this->assertStringStartsWith('Cannot modify header information',$e->getMessage()); |
|
| 27 | - } |
|
| 25 | + } catch (Exception $e) { |
|
| 26 | + $this->assertStringStartsWith('Cannot modify header information',$e->getMessage()); |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - } |
|
| 29 | + } |
|
| 30 | 30 | } |
@@ -6,15 +6,15 @@ |
||
| 6 | 6 | class ViewFavoritesTest extends PHPUnit_Framework_TestCase |
| 7 | 7 | { |
| 8 | 8 | |
| 9 | - public function test__construct() |
|
| 10 | - { |
|
| 11 | - $this->markTestIncomplete('Can Not be implemented'); |
|
| 12 | - } |
|
| 9 | + public function test__construct() |
|
| 10 | + { |
|
| 11 | + $this->markTestIncomplete('Can Not be implemented'); |
|
| 12 | + } |
|
| 13 | 13 | |
| 14 | - public function testdisplay() |
|
| 15 | - { |
|
| 16 | - $this->markTestIncomplete('Can Not be implemented'); |
|
| 17 | - } |
|
| 14 | + public function testdisplay() |
|
| 15 | + { |
|
| 16 | + $this->markTestIncomplete('Can Not be implemented'); |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | 19 | |
| 20 | 20 | } |
@@ -5,171 +5,171 @@ |
||
| 5 | 5 | |
| 6 | 6 | public function testViewList() |
| 7 | 7 | { |
| 8 | - //execute the contructor and check for the Object type and type attribute |
|
| 9 | - $view = new ViewList(); |
|
| 10 | - $this->assertInstanceOf('ViewList',$view); |
|
| 11 | - $this->assertInstanceOf('SugarView',$view); |
|
| 12 | - $this->assertAttributeEquals('list','type', $view); |
|
| 8 | + //execute the contructor and check for the Object type and type attribute |
|
| 9 | + $view = new ViewList(); |
|
| 10 | + $this->assertInstanceOf('ViewList',$view); |
|
| 11 | + $this->assertInstanceOf('SugarView',$view); |
|
| 12 | + $this->assertAttributeEquals('list','type', $view); |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | public function testoldSearch() |
| 17 | 17 | { |
| 18 | - $view = new ViewList(); |
|
| 18 | + $view = new ViewList(); |
|
| 19 | 19 | |
| 20 | - //execute the method and test if it works and does not throws an exception. |
|
| 21 | - try { |
|
| 22 | - $view->oldSearch(); |
|
| 20 | + //execute the method and test if it works and does not throws an exception. |
|
| 21 | + try { |
|
| 22 | + $view->oldSearch(); |
|
| 23 | 23 | |
| 24 | - } catch (Exception $e) { |
|
| 25 | - $this->fail(); |
|
| 26 | - } |
|
| 24 | + } catch (Exception $e) { |
|
| 25 | + $this->fail(); |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function testnewSearch() |
| 31 | 31 | { |
| 32 | - $view = new ViewList(); |
|
| 32 | + $view = new ViewList(); |
|
| 33 | 33 | |
| 34 | - //execute the method and test if it works and does not throws an exception. |
|
| 35 | - try { |
|
| 36 | - $view->newSearch(); |
|
| 34 | + //execute the method and test if it works and does not throws an exception. |
|
| 35 | + try { |
|
| 36 | + $view->newSearch(); |
|
| 37 | 37 | |
| 38 | - } catch (Exception $e) { |
|
| 39 | - $this->fail(); |
|
| 40 | - } |
|
| 38 | + } catch (Exception $e) { |
|
| 39 | + $this->fail(); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public function testlistViewPrepare() |
| 45 | 45 | { |
| 46 | - error_reporting(E_ERROR | E_PARSE); |
|
| 47 | - |
|
| 48 | - //test without setting parameters. it should return some html |
|
| 49 | - $view = new ViewList(); |
|
| 50 | - $view->module = "Users"; |
|
| 51 | - |
|
| 52 | - ob_start(); |
|
| 53 | - $view->listViewPrepare(); |
|
| 54 | - $renderedContent = ob_get_contents(); |
|
| 55 | - ob_end_clean(); |
|
| 56 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
| 57 | - |
|
| 58 | - |
|
| 59 | - //test with some REQUEST parameters preset. it should return some html and set the REQUEST key we provided in current_query_by_page REQUEST Param. |
|
| 60 | - $view = new ViewList(); |
|
| 61 | - $view->module = "Users"; |
|
| 62 | - $GLOBALS['module']= "Users"; |
|
| 63 | - $_REQUEST["Users2_USER_offset"]= 1; |
|
| 64 | - $_REQUEST['current_query_by_page'] = base64_encode(serialize(Array("key"=>"value"))); |
|
| 65 | - $view->bean = New User(); |
|
| 66 | - |
|
| 67 | - ob_start(); |
|
| 68 | - $view->listViewPrepare(); |
|
| 69 | - $renderedContent = ob_get_contents(); |
|
| 70 | - ob_end_clean(); |
|
| 71 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
| 72 | - $this->assertEquals('value',$_REQUEST['key']); |
|
| 46 | + error_reporting(E_ERROR | E_PARSE); |
|
| 47 | + |
|
| 48 | + //test without setting parameters. it should return some html |
|
| 49 | + $view = new ViewList(); |
|
| 50 | + $view->module = "Users"; |
|
| 51 | + |
|
| 52 | + ob_start(); |
|
| 53 | + $view->listViewPrepare(); |
|
| 54 | + $renderedContent = ob_get_contents(); |
|
| 55 | + ob_end_clean(); |
|
| 56 | + $this->assertGreaterThan(0,strlen($renderedContent)); |
|
| 57 | + |
|
| 58 | + |
|
| 59 | + //test with some REQUEST parameters preset. it should return some html and set the REQUEST key we provided in current_query_by_page REQUEST Param. |
|
| 60 | + $view = new ViewList(); |
|
| 61 | + $view->module = "Users"; |
|
| 62 | + $GLOBALS['module']= "Users"; |
|
| 63 | + $_REQUEST["Users2_USER_offset"]= 1; |
|
| 64 | + $_REQUEST['current_query_by_page'] = base64_encode(serialize(Array("key"=>"value"))); |
|
| 65 | + $view->bean = New User(); |
|
| 66 | + |
|
| 67 | + ob_start(); |
|
| 68 | + $view->listViewPrepare(); |
|
| 69 | + $renderedContent = ob_get_contents(); |
|
| 70 | + ob_end_clean(); |
|
| 71 | + $this->assertGreaterThan(0,strlen($renderedContent)); |
|
| 72 | + $this->assertEquals('value',$_REQUEST['key']); |
|
| 73 | 73 | |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | public function testlistViewProcess() |
| 77 | 77 | { |
| 78 | - //execute the method and call methods to get the required child objects set. it should return some html. |
|
| 79 | - $view = new ViewList(); |
|
| 80 | - $view->seed = new User(); |
|
| 81 | - $view->prepareSearchForm(); |
|
| 82 | - $view->preDisplay(); |
|
| 83 | - |
|
| 84 | - ob_start(); |
|
| 85 | - $view->listViewProcess(); |
|
| 86 | - $renderedContent = ob_get_contents(); |
|
| 87 | - ob_end_clean(); |
|
| 88 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
| 78 | + //execute the method and call methods to get the required child objects set. it should return some html. |
|
| 79 | + $view = new ViewList(); |
|
| 80 | + $view->seed = new User(); |
|
| 81 | + $view->prepareSearchForm(); |
|
| 82 | + $view->preDisplay(); |
|
| 83 | + |
|
| 84 | + ob_start(); |
|
| 85 | + $view->listViewProcess(); |
|
| 86 | + $renderedContent = ob_get_contents(); |
|
| 87 | + ob_end_clean(); |
|
| 88 | + $this->assertGreaterThan(0,strlen($renderedContent)); |
|
| 89 | 89 | |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | public function testprepareSearchForm() |
| 93 | 93 | { |
| 94 | - //test without any REQUEST parameters set. it will set searchform attribute to a searchform object. |
|
| 95 | - $view1 = new ViewList(); |
|
| 96 | - $view1->module = "Users"; |
|
| 97 | - $view1->prepareSearchForm(); |
|
| 98 | - $this->assertInstanceOf('SearchForm',$view1->searchForm); |
|
| 99 | - |
|
| 100 | - |
|
| 101 | - //test with REQUEST parameters set. it will set searchform attribute to a searchform object. |
|
| 102 | - $view2 = new ViewList(); |
|
| 103 | - $view2->module = "Users"; |
|
| 104 | - $_REQUEST['search_form'] = true; |
|
| 105 | - $_REQUEST['searchFormTab'] = 'advanced_search'; |
|
| 106 | - $view2->prepareSearchForm(); |
|
| 94 | + //test without any REQUEST parameters set. it will set searchform attribute to a searchform object. |
|
| 95 | + $view1 = new ViewList(); |
|
| 96 | + $view1->module = "Users"; |
|
| 97 | + $view1->prepareSearchForm(); |
|
| 98 | + $this->assertInstanceOf('SearchForm',$view1->searchForm); |
|
| 99 | + |
|
| 100 | + |
|
| 101 | + //test with REQUEST parameters set. it will set searchform attribute to a searchform object. |
|
| 102 | + $view2 = new ViewList(); |
|
| 103 | + $view2->module = "Users"; |
|
| 104 | + $_REQUEST['search_form'] = true; |
|
| 105 | + $_REQUEST['searchFormTab'] = 'advanced_search'; |
|
| 106 | + $view2->prepareSearchForm(); |
|
| 107 | 107 | |
| 108 | - $this->assertInstanceOf('SearchForm',$view2->searchForm); |
|
| 108 | + $this->assertInstanceOf('SearchForm',$view2->searchForm); |
|
| 109 | 109 | |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | public function testprocessSearchForm() |
| 113 | 113 | { |
| 114 | - //test without use_old_search. it should return html. |
|
| 115 | - $view = new ViewList(); |
|
| 116 | - $view->prepareSearchForm(); |
|
| 114 | + //test without use_old_search. it should return html. |
|
| 115 | + $view = new ViewList(); |
|
| 116 | + $view->prepareSearchForm(); |
|
| 117 | 117 | |
| 118 | - ob_start(); |
|
| 119 | - $view->processSearchForm(); |
|
| 120 | - $renderedContent = ob_get_contents(); |
|
| 121 | - ob_end_clean(); |
|
| 122 | - $this->assertGreaterThan(0,strlen($renderedContent)); |
|
| 118 | + ob_start(); |
|
| 119 | + $view->processSearchForm(); |
|
| 120 | + $renderedContent = ob_get_contents(); |
|
| 121 | + ob_end_clean(); |
|
| 122 | + $this->assertGreaterThan(0,strlen($renderedContent)); |
|
| 123 | 123 | |
| 124 | 124 | |
| 125 | - //test with use_old_search = true. there is a $view variable which is never set so it doesn't returns anything. |
|
| 126 | - $view = new ViewList(); |
|
| 127 | - $view->prepareSearchForm(); |
|
| 128 | - $view->use_old_search = true; |
|
| 125 | + //test with use_old_search = true. there is a $view variable which is never set so it doesn't returns anything. |
|
| 126 | + $view = new ViewList(); |
|
| 127 | + $view->prepareSearchForm(); |
|
| 128 | + $view->use_old_search = true; |
|
| 129 | 129 | |
| 130 | - ob_start(); |
|
| 131 | - $view->processSearchForm(); |
|
| 132 | - $renderedContent = ob_get_contents(); |
|
| 133 | - ob_end_clean(); |
|
| 134 | - $this->assertEquals(0,strlen($renderedContent)); |
|
| 130 | + ob_start(); |
|
| 131 | + $view->processSearchForm(); |
|
| 132 | + $renderedContent = ob_get_contents(); |
|
| 133 | + ob_end_clean(); |
|
| 134 | + $this->assertEquals(0,strlen($renderedContent)); |
|
| 135 | 135 | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | |
| 139 | 139 | public function testpreDisplay() |
| 140 | 140 | { |
| 141 | - //execute the method and test if it sets the lv attribute to ListViewSmarty object. |
|
| 142 | - $view = new ViewList(); |
|
| 143 | - $view->preDisplay(); |
|
| 144 | - $this->assertInstanceOf('ListViewSmarty',$view->lv); |
|
| 141 | + //execute the method and test if it sets the lv attribute to ListViewSmarty object. |
|
| 142 | + $view = new ViewList(); |
|
| 143 | + $view->preDisplay(); |
|
| 144 | + $this->assertInstanceOf('ListViewSmarty',$view->lv); |
|
| 145 | 145 | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | public function testdisplay() |
| 149 | 149 | { |
| 150 | - $view = new ViewList(); |
|
| 150 | + $view = new ViewList(); |
|
| 151 | 151 | |
| 152 | - //test without setting bean attibute. it shuold return no access html. |
|
| 153 | - ob_start(); |
|
| 154 | - $view->display(); |
|
| 155 | - $renderedContent1 = ob_get_contents(); |
|
| 156 | - ob_end_clean(); |
|
| 157 | - $this->assertGreaterThan(0,strlen($renderedContent1)); |
|
| 152 | + //test without setting bean attibute. it shuold return no access html. |
|
| 153 | + ob_start(); |
|
| 154 | + $view->display(); |
|
| 155 | + $renderedContent1 = ob_get_contents(); |
|
| 156 | + ob_end_clean(); |
|
| 157 | + $this->assertGreaterThan(0,strlen($renderedContent1)); |
|
| 158 | 158 | |
| 159 | 159 | |
| 160 | - //test with bean, seed and other arrtibutes set. it shuold return html. |
|
| 161 | - $view->bean = new User(); |
|
| 162 | - $view->seed = new User(); |
|
| 163 | - $view->module = "Users"; |
|
| 164 | - $view->prepareSearchForm(); |
|
| 165 | - $view->preDisplay(); |
|
| 166 | - |
|
| 167 | - ob_start(); |
|
| 168 | - |
|
| 169 | - $view->display(); |
|
| 170 | - $renderedContent2 = ob_get_contents(); |
|
| 171 | - ob_end_clean(); |
|
| 172 | - $this->assertGreaterThan(0,strlen($renderedContent2)); |
|
| 160 | + //test with bean, seed and other arrtibutes set. it shuold return html. |
|
| 161 | + $view->bean = new User(); |
|
| 162 | + $view->seed = new User(); |
|
| 163 | + $view->module = "Users"; |
|
| 164 | + $view->prepareSearchForm(); |
|
| 165 | + $view->preDisplay(); |
|
| 166 | + |
|
| 167 | + ob_start(); |
|
| 168 | + |
|
| 169 | + $view->display(); |
|
| 170 | + $renderedContent2 = ob_get_contents(); |
|
| 171 | + ob_end_clean(); |
|
| 172 | + $this->assertGreaterThan(0,strlen($renderedContent2)); |
|
| 173 | 173 | |
| 174 | 174 | |
| 175 | 175 | |