Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit bf8fda3

Browse files
author
Jamie Snape
committed
Formatting tweaks in tests folder
1 parent db57943 commit bf8fda3

File tree

7 files changed

+200
-174
lines changed

7 files changed

+200
-174
lines changed

tests/CMakeLists.txt

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
#=============================================================================
2+
# MIDAS Server
3+
# Copyright (c) Kitware SAS. 26 rue Louis Guérin. 69100 Villeurbanne, FRANCE
4+
# All rights reserved.
5+
# More information http://www.kitware.com
6+
#
7+
# Licensed under the Apache License, Version 2.0 (the "License");
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0.txt
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
#=============================================================================
19+
120
# Create the configuredVars.php file used for testing
221
option(MIDAS_TEST_COVERAGE "Perform xdebug coverage. Only turn on if you need coverage." OFF)
322

@@ -76,7 +95,6 @@ endfunction(add_midas_style_test)
7695
add_midas_style_test( StyleTestsControllerTestCase ${CMAKE_SOURCE_DIR}/tests/ControllerTestCase.php )
7796
add_midas_style_test( StyleTestsDatabaseTestCase ${CMAKE_SOURCE_DIR}/tests/DatabaseTestCase.php )
7897

79-
8098
add_test(Utf8encoding ${PHP} ${CMAKE_SOURCE_DIR}/tests/Utf8tools.php --src ${CMAKE_SOURCE_DIR})
8199
set_tests_properties(
82100
Utf8encoding PROPERTIES

tests/ControllerTestCase.php

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ public function getBody()
9797
*/
9898
protected function getDataSet($name = 'default', $module = null)
9999
{
100-
$path = BASE_PATH.'/core/tests/databaseDataset/'.$name.".xml";
100+
$path = BASE_PATH.'/core/tests/databaseDataset/'.$name.'.xml';
101101
if(isset($module) && !empty($module))
102102
{
103-
$path = BASE_PATH.'/modules/'.$module.'/tests/databaseDataset/'.$name.".xml";
103+
$path = BASE_PATH.'/modules/'.$module.'/tests/databaseDataset/'.$name.'.xml';
104104
}
105105
return new PHPUnit_Extensions_Database_DataSet_FlatXmlDataSet($path);
106106
}
@@ -131,7 +131,7 @@ private function _initModule()
131131
$router = Zend_Controller_Front::getInstance()->getRouter();
132132
//Init Modules
133133
$frontController = Zend_Controller_Front::getInstance();
134-
$frontController->addControllerDirectory(BASE_PATH . '/core/controllers');
134+
$frontController->addControllerDirectory(BASE_PATH.'/core/controllers');
135135
if(isset($this->enabledModules) || (isset($_POST['enabledModules']) || isset($_GET['enabledModules'])))
136136
{
137137
if(isset($this->enabledModules))
@@ -150,13 +150,13 @@ private function _initModule()
150150
foreach($paramsTestingModules as $p)
151151
{
152152
$modules[$p] = 1;
153-
if(file_exists(BASE_PATH . "/modules/".$p."/constant/module.php"))
153+
if(file_exists(BASE_PATH.'/modules/'.$p.'/constant/module.php'))
154154
{
155-
require_once BASE_PATH . "/modules/".$p."/constant/module.php";
155+
require_once BASE_PATH.'/modules/'.$p.'/constant/module.php';
156156
}
157-
if(file_exists(BASE_PATH . "/privateModules/".$p."/constant/module.php"))
157+
if(file_exists(BASE_PATH.'/privateModules/'.$p.'/constant/module.php'))
158158
{
159-
require_once BASE_PATH . "/privateModules/".$p."/constant/module.php";
159+
require_once BASE_PATH.'/privateModules/'.$p.'/constant/module.php';
160160
}
161161
}
162162
}
@@ -174,9 +174,9 @@ private function _initModule()
174174
{
175175
$listeModule[] = $key;
176176
// get WebApi controller directories and WebApi module names for enabled modules
177-
if(file_exists(BASE_PATH . "/modules/".$key."/controllers/api"))
177+
if(file_exists(BASE_PATH.'/modules/'.$key.'/controllers/api'))
178178
{
179-
$frontController->addControllerDirectory(BASE_PATH . "/modules/".$key."/controllers/api", "api".$key);
179+
$frontController->addControllerDirectory(BASE_PATH.'/modules/'.$key.'/controllers/api', 'api'.$key);
180180
$apiModules[] = $key;
181181
}
182182
}
@@ -185,13 +185,13 @@ private function _initModule()
185185
require_once BASE_PATH.'/core/controllers/components/UtilityComponent.php';
186186
$utilityComponent = new UtilityComponent();
187187
// get WebApi controller directory for core Apis
188-
require_once BASE_PATH . "/core/ApiController.php";
189-
$frontController->addControllerDirectory(BASE_PATH . '/core/controllers/api', 'rest');
188+
require_once BASE_PATH.'/core/ApiController.php';
189+
$frontController->addControllerDirectory(BASE_PATH.'/core/controllers/api', 'rest');
190190
// add restful route for WebApis
191191
$restRoute = new Zend_Rest_Route($frontController, array(), array('rest'));
192192
// add regular route for apikey configuration page
193-
$router->addRoute("rest-apikey",
194-
new Zend_Controller_Router_Route("/apikey/:action/",
193+
$router->addRoute('rest-apikey',
194+
new Zend_Controller_Router_Route('/apikey/:action/',
195195
array(
196196
'module' => 'rest',
197197
'controller' => 'apikey')));
@@ -200,33 +200,33 @@ private function _initModule()
200200
{
201201
$route = $m;
202202
$nameModule = $m;
203-
$router->addRoute($nameModule."-1",
204-
new Zend_Controller_Router_Route("".$route."/:controller/:action/*",
203+
$router->addRoute($nameModule.'-1',
204+
new Zend_Controller_Router_Route(''.$route.'/:controller/:action/*',
205205
array(
206206
'module' => $nameModule)));
207-
$router->addRoute($nameModule."-2",
208-
new Zend_Controller_Router_Route("".$route."/:controller/",
207+
$router->addRoute($nameModule.'-2',
208+
new Zend_Controller_Router_Route(''.$route.'/:controller/',
209209
array(
210210
'module' => $nameModule,
211211
'action' => 'index')));
212-
$router->addRoute($nameModule."-3",
213-
new Zend_Controller_Router_Route("".$route."/",
212+
$router->addRoute($nameModule.'-3',
213+
new Zend_Controller_Router_Route(''.$route.'/',
214214
array(
215215
'module' => $nameModule,
216216
'controller' => 'index',
217217
'action' => 'index')));
218-
$frontController->addControllerDirectory(BASE_PATH . "/modules/".$route."/controllers", $nameModule);
219-
if(file_exists(BASE_PATH . "/modules/".$route."/AppController.php"))
218+
$frontController->addControllerDirectory(BASE_PATH.'/modules/'.$route.'/controllers', $nameModule);
219+
if(file_exists(BASE_PATH.'/modules/'.$route.'/AppController.php'))
220220
{
221-
require_once BASE_PATH . "/modules/".$route."/AppController.php";
221+
require_once BASE_PATH.'/modules/'.$route.'/AppController.php';
222222
}
223-
if(file_exists(BASE_PATH . "/modules/".$route."/models/AppDao.php"))
223+
if(file_exists(BASE_PATH.'/modules/'.$route.'/models/AppDao.php'))
224224
{
225-
require_once BASE_PATH . "/modules/".$route."/models/AppDao.php";
225+
require_once BASE_PATH.'/modules/'.$route.'/models/AppDao.php';
226226
}
227-
if(file_exists(BASE_PATH . "/modules/".$route."/models/AppModel.php"))
227+
if(file_exists(BASE_PATH.'/modules/'.$route.'/models/AppModel.php'))
228228
{
229-
require_once BASE_PATH . "/modules/".$route."/models/AppModel.php";
229+
require_once BASE_PATH.'/modules/'.$route.'/models/AppModel.php';
230230
}
231231
}
232232
Zend_Registry::set('modulesEnable', $listeModule);
@@ -267,7 +267,7 @@ public function dispatchUrI($uri, $userDao = null, $withException = false, $asse
267267

268268
if(isset($this->enabledModules) && !empty($this->enabledModules))
269269
{
270-
$this->params['enabledModules'] = join(";", $this->enabledModules);
270+
$this->params['enabledModules'] = join(';', $this->enabledModules);
271271
}
272272
else
273273
{
@@ -287,14 +287,14 @@ public function dispatchUrI($uri, $userDao = null, $withException = false, $asse
287287
{
288288
$this->assertNotResponseCode('404');
289289
}
290-
if($this->request->getControllerName() == "error")
290+
if($this->request->getControllerName() == 'error')
291291
{
292292
if($withException)
293293
{
294294
return;
295295
}
296296
$error = $this->request->getParam('error_handler');
297-
Zend_Loader::loadClass("NotifyErrorComponent", BASE_PATH . '/core/controllers/components');
297+
Zend_Loader::loadClass('NotifyErrorComponent', BASE_PATH.'/core/controllers/components');
298298
$errorComponent = new NotifyErrorComponent();
299299
$mailer = new Zend_Mail();
300300
$session = new Zend_Session_Namespace('Auth_User');
@@ -324,7 +324,7 @@ public function resetAll()
324324
{
325325
$this->reset();
326326
$this->params = array();
327-
$this->frontController->setControllerDirectory(BASE_PATH . '/core/controllers', 'default');
327+
$this->frontController->setControllerDirectory(BASE_PATH.'/core/controllers', 'default');
328328
$this->_initModule();
329329
$this->_initREST();
330330
}
@@ -333,7 +333,7 @@ public function resetAll()
333333
public function appBootstrap()
334334
{
335335
$this->application = new Zend_Application(APPLICATION_ENV, CORE_CONFIG);
336-
$this->frontController->setControllerDirectory(BASE_PATH . '/core/controllers', 'default');
336+
$this->frontController->setControllerDirectory(BASE_PATH.'/core/controllers', 'default');
337337
$this->_initModule();
338338
$this->_initREST();
339339
$this->application->bootstrap();
@@ -343,28 +343,28 @@ public function appBootstrap()
343343
public function setupDatabase($files, $module = null)
344344
{
345345
$db = Zend_Registry::get('dbAdapter');
346-
$configDatabase = Zend_Registry::get('configDatabase' );
346+
$configDatabase = Zend_Registry::get('configDatabase');
347347
$connection = new Zend_Test_PHPUnit_Db_Connection($db, $configDatabase->database->params->dbname);
348348
$databaseTester = new Zend_Test_PHPUnit_Db_SimpleTester($connection);
349349
if(is_array($files))
350350
{
351351
foreach($files as $f)
352352
{
353-
$path = BASE_PATH.'/core/tests/databaseDataset/'.$f.".xml";
353+
$path = BASE_PATH.'/core/tests/databaseDataset/'.$f.'.xml';
354354
if(isset($module))
355355
{
356-
$path = BASE_PATH.'/modules/'.$module.'/tests/databaseDataset/'.$f.".xml";
356+
$path = BASE_PATH.'/modules/'.$module.'/tests/databaseDataset/'.$f.'.xml';
357357
}
358358
$databaseFixture = new PHPUnit_Extensions_Database_DataSet_FlatXmlDataSet($path);
359359
$databaseTester->setupDatabase($databaseFixture);
360360
}
361361
}
362362
else
363363
{
364-
$path = BASE_PATH.'/core/tests/databaseDataset/'.$files.".xml";
364+
$path = BASE_PATH.'/core/tests/databaseDataset/'.$files.'.xml';
365365
if(isset($module))
366366
{
367-
$path = BASE_PATH.'/modules/'.$module.'/tests/databaseDataset/'.$files.".xml";
367+
$path = BASE_PATH.'/modules/'.$module.'/tests/databaseDataset/'.$files.'.xml';
368368
}
369369
$databaseFixture = new PHPUnit_Extensions_Database_DataSet_FlatXmlDataSet($path);
370370
$databaseTester->setupDatabase($databaseFixture);
@@ -401,7 +401,7 @@ public function loadElements()
401401
{
402402
foreach($this->_daos as $dao)
403403
{
404-
Zend_Loader::loadClass($dao . "Dao", BASE_PATH.'/core/models/dao');
404+
Zend_Loader::loadClass($dao.'Dao', BASE_PATH.'/core/models/dao');
405405
}
406406
}
407407

@@ -410,8 +410,8 @@ public function loadElements()
410410
{
411411
foreach($this->_components as $component)
412412
{
413-
$nameComponent = $component . "Component";
414-
Zend_Loader::loadClass($nameComponent, BASE_PATH . '/core/controllers/components');
413+
$nameComponent = $component.'Component';
414+
Zend_Loader::loadClass($nameComponent, BASE_PATH.'/core/controllers/components');
415415
@$this->Component->$component = new $nameComponent();
416416
}
417417
}
@@ -421,11 +421,11 @@ public function loadElements()
421421
{
422422
foreach($this->_forms as $forms)
423423
{
424-
$nameForm = $forms . "Form";
424+
$nameForm = $forms.'Form';
425425

426-
Zend_Loader::loadClass($nameForm, BASE_PATH . '/core/controllers/forms');
426+
Zend_Loader::loadClass($nameForm, BASE_PATH.'/core/controllers/forms');
427427
@$this->Form->$forms = new $nameForm();
428428
}
429429
}
430430
}
431-
}//end class
431+
}

0 commit comments

Comments
 (0)