Esempio n. 1
0
function execAction($route)
{
    $ctrl = loadController($route);
    $act = "action" . ucfirst($route['act']);
    if (method_exists($ctrl, $act)) {
        $ctrl->{$act}();
    } else {
        die("页面不存在!");
    }
}
 public function __construct()
 {
     parent::__construct();
     if (!bt_cloaker_enabled()) {
         echo 0;
         BTApp::end();
     }
     $this->loadModel('CloakerModel');
     $this->loadModel('CloakerOptionModel');
     $this->loadModel('CampaignModel');
     $this->loadModel("ClickAdvancedModel");
     require_once BT_ROOT . '/private/includes/cloaker.php';
     loadController("TrackerController");
 }
Esempio n. 3
0
function run()
{
    try {
        if (!isset($_GET["controller"])) {
            $_GET["controller"] = DEFAULT_CONTROLLER;
        }
        if (!isset($_GET["action"])) {
            $_GET["action"] = DEFAULT_ACTION;
        }
        $controller = loadController($_GET["controller"]);
        $actionName = $_GET["action"];
        $controller->{$actionName}();
    } catch (Exception $ex) {
        die("An exception occured!!!!!" . $ex->getMessage());
    }
}
Esempio n. 4
0
 /**
  * Class constructor.
  *
  * @param string $method
  * @param array $messages
  * @return unknown
  */
 function __construct($method, $messages)
 {
     parent::__construct();
     static $__previousError = null;
     $allow = array('.', '/', '_', ' ', '-', '~');
     if (substr(PHP_OS, 0, 3) == "WIN") {
         $allow = array_merge($allow, array('\\', ':'));
     }
     $clean = new Sanitize();
     $messages = $clean->paranoid($messages, $allow);
     if (!class_exists('Dispatcher')) {
         require CAKE . 'dispatcher.php';
     }
     $this->__dispatch =& new Dispatcher();
     if ($__previousError != array($method, $messages)) {
         $__previousError = array($method, $messages);
         if (!class_exists('AppController')) {
             loadController(null);
         }
         $this->controller =& new AppController();
         if (!empty($this->controller->uses)) {
             $this->controller->constructClasses();
         }
         $this->controller->_initComponents();
         $this->controller->cacheAction = false;
         $this->__dispatch->start($this->controller);
         if (method_exists($this->controller, 'apperror')) {
             return $this->controller->appError($method, $messages);
         }
     } else {
         $this->controller =& new Controller();
         $this->controller->cacheAction = false;
     }
     if (Configure::read() > 0 || $method == 'error') {
         call_user_func_array(array(&$this, $method), $messages);
     } else {
         call_user_func_array(array(&$this, 'error404'), $messages);
     }
 }
Esempio n. 5
0
/**
 * Main router (single entry-point for all requests)
 * of the MVC implementation.
 * 
 * This router will create an instance of the corresponding
 * controller, based on the "controller" parameter and call
 * the corresponding method, based on the "action" parameter.
 * 
 * The rest of GET or POST parameters should be handled by
 * the controller itself.
 * 
 * Parameters:
 * <ul>
 * <li>controller: The controller name (via HTTP GET)
 * <li>action: The name inside the controller (via HTTP GET)
 * </ul>
 * 
 * @return void
 * 
 * @author lipido <*****@*****.**>
 */
function run()
{
    // invoke action!
    try {
        if (!isset($_GET["controller"])) {
            $_GET["controller"] = DEFAULT_CONTROLLER;
        }
        if (!isset($_GET["action"])) {
            $_GET["action"] = DEFAULT_ACTION;
        }
        // Here is where the "magic" occurs.
        // URLs like: index.php?controller=posts&action=add
        // will provoke a call to: new PostsController()->add()
        // Instantiate the corresponding controller
        $controller = loadController($_GET["controller"]);
        // Call the corresponding action
        $actionName = $_GET["action"];
        $controller->{$actionName}();
    } catch (Exception $ex) {
        //uniform treatment of exceptions
        die("An exception occured!!!!!" . $ex->getMessage());
    }
}
Esempio n. 6
0
 /**
  * load Controller
  *
  * @param string  $name
  */
 function loadController($name)
 {
     if (class_exists('App')) {
         App::import('Controller', $name);
     } else {
         loadController($name);
     }
 }
<?php

loadController('AdminController');
class AdminAccountsController extends AdminController
{
    public function indexAction()
    {
        $this->setVar("title", "Manage Accounts");
        $this->render("admin/accounts");
    }
    public function ajaxAction($command = '', $params = array())
    {
        switch ($command) {
            case 'view_accountlist':
                $userlist = UserModel::model()->getRows();
                $this->setVar("userlist", $userlist);
                $this->loadView("admin/accounts_list");
                break;
            case 'json_user':
                $user = UserModel::model()->getRowFromPk($_GET['user_id']);
                echo $user->toJSON();
                break;
            case 'post_delete':
                $user_id = $_POST['user_id'];
                $user = UserModel::model()->getRowFromPk($user_id);
                $user->delete();
                break;
            case 'post_add':
                $user = UserModel::model();
                $user->user_name = $_POST['user_name'];
                $user->email = $_POST['email'];
<?php

loadController('OrderStatuses');
class OrderStatusesControllerTestCase extends CakeTestCase
{
    var $TestObject = null;
    function setUp()
    {
        $this->TestObject = new OrderStatusesController();
    }
    function tearDown()
    {
        unset($this->TestObject);
    }
}
<?php

loadController('Galleries');
class GalleriesControllerTestCase extends UnitTestCase
{
    var $object = null;
    function setUp()
    {
        $this->object = new GalleriesController();
    }
    function tearDown()
    {
        unset($this->object);
    }
}
Esempio n. 10
0
<?php

//Load the base controller
require_once 'core/BaseController.php';
//Load extra functions to front
require_once 'core/controller.extra.php';
//Load the controllers
if (isset($_GET["controller"])) {
    $controllerObj = loadController($_GET["controller"]);
    runAction($controllerObj);
} else {
    $controllerObj = loadController('Home');
    runAction($controllerObj);
}
<?php

loadController('Countries');
class CountriesControllerTestCase extends CakeTestCase
{
    var $TestObject = null;
    function setUp()
    {
        $this->TestObject = new CountriesController();
    }
    function tearDown()
    {
        unset($this->TestObject);
    }
}
Esempio n. 12
0
include_once S_ROOT . './source/function_user.php';
include_once S_ROOT . './models/mysqlDBA.php';
//时间
$mtime = explode(' ', microtime());
$_SGLOBAL['timestamp'] = $mtime[1];
$_SGLOBAL['supe_starttime'] = $_SGLOBAL['timestamp'] + $mtime[0];
if (defined('SHOW_PAGE_TIME')) {
    //页面速度测试
    $mtime = explode(' ', microtime());
    $sqlstarttime = number_format($mtime[1] + $mtime[0] - $_SGLOBAL['supe_starttime'], 6) * 1000;
}
//初始化
$_SGLOBAL['query_string'] = $_SERVER['QUERY_STRING'];
$_SGLOBAL['inajax'] = empty($_GET['inajax']) ? 0 : intval($_GET['inajax']);
$_SGLOBAL['mobile'] = empty($_GET['mobile']) ? 0 : trim($_GET['mobile']);
$_SGLOBAL['refer'] = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
require_once S_ROOT . "./config/global.conf.php";
//全局数组
if (file_exists(S_ROOT . "./config/app/" . APP . ".conf.php")) {
    require_once S_ROOT . "./config/app/" . APP . ".conf.php";
    //APP全局数组
}
if (REWRITE_URL) {
    $_NGET = parseRewriteQueryString($_SGLOBAL['query_string']);
    !empty($_NGET['controller']) && ($_GET = $_NGET);
    $_SGLOBAL['query_string'] = _queryString($_SGLOBAL['query_string']);
}
dbconnect(APP);
//连接数据库
loadController($arrController, APP);
$_SGLOBAL['memory'] = memory_get_usage();
Esempio n. 13
0
 /**
  * Load dependencies for given element (controller/component/helper)
  *
  * @param string $element Element to load dependency for
  * @access private
  */
 function __loadDependencies($element)
 {
     switch (low($element)) {
         case 'behavior':
             loadModel(null);
             loadBehavior(null);
             break;
         case 'controller':
             loadController(null);
             break;
         case 'component':
             loadComponent(null);
             break;
         case 'helper':
             uses('view' . DS . 'helper');
             loadHelper(null);
             break;
         case 'model':
             loadModel(null);
             break;
     }
 }
<?php

loadController('CustomerGroups');
class CustomerGroupsControllerTestCase extends UnitTestCase
{
    var $object = null;
    function setUp()
    {
        $this->object = new CustomerGroupsController();
    }
    function tearDown()
    {
        unset($this->object);
    }
}
<?php

loadController('categorias');
class categoriasControllerTestCase extends UnitTestCase
{
    var $object = null;
    function setUp()
    {
        $this->object = new categoriasController();
    }
    function tearDown()
    {
        unset($this->object);
    }
}
<?php

loadController('Configurations');
class ConfigurationsControllerTestCase extends UnitTestCase
{
    var $TestObject = null;
    function setUp()
    {
        $this->TestObject = new ConfigurationsController();
    }
    function tearDown()
    {
        unset($this->TestObject);
    }
}
<?php

loadController('menus');
class menusControllerTestCase extends UnitTestCase
{
    var $object = null;
    function setUp()
    {
        $this->object = new menusController();
    }
    function tearDown()
    {
        unset($this->object);
    }
}
Esempio n. 18
0
ini_set("display_errors", 1);
//Gestor de sesiones -->
session_start();
//Rutas y Directorios -->
defined("DS") ? null : define("DS", DIRECTORY_SEPARATOR);
defined("ROOT") ? null : define("ROOT", dirname(__FILE__) . DS . ".." . DS);
// Crear objeto o clase vacia -->
$G = new StdClass();
// Incluir el archivo de funciones generales -->
require_once ROOT . DS . "app" . DS . "functions.php";
// Gestionar las Excepciones -->
set_error_handler("loadErrorHandler");
// Incluir el archivo de configuracion de base de datos -->
require_once ROOT . DS . "app" . DS . "config.php";
// Conectar a la Base de Datos -->
try {
    $G->db = new PDO("mysql:host=" . DB_HOST . ";dbname=" . DB_NAME, DB_USER, DB_PASS);
    //Cargamos la configuracion del sitio -->
    $query_config = $G->db->prepare("SELECT * FROM " . DB_PREFIX . "config WHERE wid = 1");
    $query_config->execute();
    if ($query_config->rowCount()) {
        $G->config = $query_config->fetch();
    }
} catch (PDOException $e) {
    die(customPDOError($e->getCode(), $e->getTrace()));
}
//Crear la instancia de la clase Usuario -->
$G->user = new User();
$G->controller = isset($_GET["controller"]) ? htmlentities(trim($_GET["controller"])) : "home";
loadController($G->controller);
<?php

loadController('Copyrights');
class CopyrightsControllerTestCase extends UnitTestCase
{
    var $object = null;
    function setUp()
    {
        $this->object = new CopyrightsController();
    }
    function tearDown()
    {
        unset($this->object);
    }
}
<?php

loadController('CentroCustos');
class CentroCustosControllerTestCase extends UnitTestCase
{
    var $object = null;
    function setUp()
    {
        $this->object = new CentroCustosController();
    }
    function tearDown()
    {
        unset($this->object);
    }
}
Esempio n. 21
0
 /**
  * Action to create a View.
  *
  */
 function doView()
 {
     $this->hr();
     $this->stdout('View Bake:');
     $this->hr();
     $uses = array();
     $wannaUseSession = 'y';
     $wannaDoScaffold = 'y';
     $useDbConfig = 'default';
     $this->__doList($useDbConfig, 'Controllers');
     $enteredController = '';
     while ($enteredController == '') {
         $enteredController = $this->getInput('Enter a number from the list above, or type in the name of another controller.');
         if ($enteredController == '' || intval($enteredController) > count($this->__controllerNames)) {
             $this->stdout('Error:');
             $this->stdout("The Controller name you supplied was empty, or the number \nyou selected was not an option. Please try again.");
             $enteredController = '';
         }
     }
     if (intval($enteredController) > 0 && intval($enteredController) <= count($this->__controllerNames)) {
         $controllerName = $this->__controllerNames[intval($enteredController) - 1];
     } else {
         $controllerName = Inflector::camelize($enteredController);
     }
     $controllerPath = low(Inflector::underscore($controllerName));
     $doItInteractive = $this->getInput("Would you like bake to build your views interactively?\nWarning: Choosing no will overwrite {$controllerClassName} views if it exist.", array('y', 'n'), 'y');
     if (low($doItInteractive) == 'y' || low($doItInteractive) == 'yes') {
         $this->interactive = true;
         $wannaDoScaffold = $this->getInput("Would you like to create some scaffolded views (index, add, view, edit) for this controller?\nNOTE: Before doing so, you'll need to create your controller and model classes (including associated models).", array('y', 'n'), 'n');
     }
     $admin = null;
     $admin_url = null;
     if (low($wannaDoScaffold) == 'y' || low($wannaDoScaffold) == 'yes') {
         $wannaDoAdmin = $this->getInput("Would you like to create the views for admin routing?", array('y', 'n'), 'n');
     }
     if (low($wannaDoAdmin) == 'y' || low($wannaDoAdmin) == 'yes') {
         require CONFIGS . 'core.php';
         if (defined('CAKE_ADMIN')) {
             $admin = CAKE_ADMIN . '_';
             $admin_url = '/' . CAKE_ADMIN;
         } else {
             $adminRoute = '';
             $this->stdout('You need to enable CAKE_ADMIN in /app/config/core.php to use admin routing.');
             $this->stdout('What would you like the admin route to be?');
             $this->stdout('Example: www.example.com/admin/controller');
             while ($adminRoute == '') {
                 $adminRoute = $this->getInput("What would you like the admin route to be?", null, 'admin');
             }
             if ($this->__addAdminRoute($adminRoute) !== true) {
                 $this->stdout('Unable to write to /app/config/core.php.');
                 $this->stdout('You need to enable CAKE_ADMIN in /app/config/core.php to use admin routing.');
                 exit;
             } else {
                 $admin = $adminRoute . '_';
                 $admin_url = '/' . $adminRoute;
             }
         }
     }
     if (low($wannaDoScaffold) == 'y' || low($wannaDoScaffold) == 'yes') {
         $file = CONTROLLERS . $controllerPath . '_controller.php';
         if (!file_exists($file)) {
             $shortPath = str_replace(ROOT, null, $file);
             $shortPath = str_replace('../', '', $shortPath);
             $shortPath = str_replace('//', '/', $shortPath);
             $this->stdout('');
             $this->stdout("The file '{$shortPath}' could not be found.\nIn order to scaffold, you'll need to first create the controller. ");
             $this->stdout('');
             die;
         } else {
             uses('controller' . DS . 'controller');
             loadController($controllerName);
             //loadModels();
             if ($admin) {
                 $this->__bakeViews($controllerName, $controllerPath, $admin, $admin_url);
             }
             $this->__bakeViews($controllerName, $controllerPath, null, null);
             $this->hr();
             $this->stdout('');
             $this->stdout('View Scaffolding Complete.' . "\n");
         }
     } else {
         $actionName = '';
         while ($actionName == '') {
             $actionName = $this->getInput('Action Name? (use camelCased function name)');
             if ($actionName == '') {
                 $this->stdout('The action name you supplied was empty. Please try again.');
             }
         }
         $this->stdout('');
         $this->hr();
         $this->stdout('The following view will be created:');
         $this->hr();
         $this->stdout("Controller Name: {$controllerName}");
         $this->stdout("Action Name:     {$actionName}");
         $this->stdout("Path:            app/views/" . $controllerPath . DS . Inflector::underscore($actionName) . '.thtml');
         $this->hr();
         $looksGood = $this->getInput('Look okay?', array('y', 'n'), 'y');
         if (low($looksGood) == 'y' || low($looksGood) == 'yes') {
             $this->bakeView($controllerName, $actionName);
         } else {
             $this->stdout('Bake Aborted.');
         }
     }
 }
<?php

loadController('Users');
class UsersControllerTestCase extends UnitTestCase
{
    var $object = null;
    function setUp()
    {
        $this->object = new UsersController();
    }
    function tearDown()
    {
        unset($this->object);
    }
}
Esempio n. 23
0
 /**
  * Dispatches and invokes given URL, handing over control to the involved controllers, and then renders the results (if autoRender is set).
  *
  * If no controller of given name can be found, invoke() shows error messages in
  * the form of Missing Controllers information. It does the same with Actions (methods of Controllers are called
  * Actions).
  *
  * @param string $url	URL information to work on.
  * @param array $additionalParams	Settings array ("bare", "return"),
  * which is melded with the GET and POST params.
  * @return boolean		Success
  */
 function dispatch($url, $additionalParams = array())
 {
     $params = array_merge($this->parseParams($url), $additionalParams);
     $missingController = false;
     $missingAction = false;
     $missingView = false;
     $privateAction = false;
     $this->base = $this->baseUrl();
     if (empty($params['controller'])) {
         $missingController = true;
     } else {
         $ctrlName = Inflector::camelize($params['controller']);
         $ctrlClass = $ctrlName . 'Controller';
         if (!loadController($ctrlName)) {
             $pluginName = Inflector::camelize($params['action']);
             if (!loadPluginController(Inflector::underscore($ctrlName), $pluginName)) {
                 if (preg_match('/([\\.]+)/', $ctrlName)) {
                     return $this->cakeError('error404', array(array('url' => strtolower($ctrlName), 'message' => 'Was not found on this server', 'base' => $this->base)));
                 } elseif (!class_exists($ctrlClass)) {
                     $missingController = true;
                 } else {
                     $params['plugin'] = null;
                     $this->plugin = null;
                 }
             } else {
                 $params['plugin'] = Inflector::underscore($ctrlName);
             }
         } else {
             $params['plugin'] = null;
             $this->plugin = null;
         }
     }
     if (isset($params['plugin'])) {
         $plugin = $params['plugin'];
         $pluginName = Inflector::camelize($params['action']);
         $pluginClass = $pluginName . 'Controller';
         $ctrlClass = $pluginClass;
         $oldAction = $params['action'];
         $params = $this->_restructureParams($params);
         $this->plugin = $plugin;
         loadPluginModels($plugin);
         $this->base = $this->base . '/' . Inflector::underscore($ctrlName);
         if (empty($params['controller']) || !class_exists($pluginClass)) {
             $params['controller'] = Inflector::underscore($ctrlName);
             $ctrlClass = $ctrlName . 'Controller';
             if (!is_null($params['action'])) {
                 array_unshift($params['pass'], $params['action']);
             }
             $params['action'] = $oldAction;
         }
     }
     if (empty($params['action'])) {
         $params['action'] = 'index';
     }
     if (defined('CAKE_ADMIN')) {
         if (isset($params[CAKE_ADMIN])) {
             $this->admin = '/' . CAKE_ADMIN;
             $url = preg_replace('/' . CAKE_ADMIN . '(\\/|$)/', '', $url);
             $params['action'] = CAKE_ADMIN . '_' . $params['action'];
         } elseif (strpos($params['action'], CAKE_ADMIN) === 0) {
             $privateAction = true;
         }
     }
     if ($missingController) {
         return $this->cakeError('missingController', array(array('className' => Inflector::camelize($params['controller'] . "Controller"), 'webroot' => $this->webroot, 'url' => $url, 'base' => $this->base)));
     } else {
         $controller =& new $ctrlClass();
     }
     $classMethods = get_class_methods($controller);
     $classVars = get_object_vars($controller);
     if ((in_array($params['action'], $classMethods) || in_array(strtolower($params['action']), $classMethods)) && strpos($params['action'], '_', 0) === 0) {
         $privateAction = true;
     }
     if (!in_array($params['action'], $classMethods) && !in_array(strtolower($params['action']), $classMethods)) {
         $missingAction = true;
     }
     if (in_array(strtolower($params['action']), array('object', 'tostring', 'requestaction', 'log', 'cakeerror', 'constructclasses', 'redirect', 'set', 'setaction', 'validate', 'validateerrors', 'render', 'referer', 'flash', 'flashout', 'generatefieldnames', 'postconditions', 'cleanupfields', 'beforefilter', 'beforerender', 'afterfilter'))) {
         $missingAction = true;
     }
     if (in_array('return', array_keys($params)) && $params['return'] == 1) {
         $controller->autoRender = false;
     }
     $controller->base = $this->base;
     $base = strip_plugin($this->base, $this->plugin);
     if (defined("BASE_URL")) {
         $controller->here = $base . $this->admin . $url;
     } else {
         $controller->here = $base . $this->admin . '/' . $url;
     }
     $controller->webroot = $this->webroot;
     $controller->params = $params;
     $controller->action = $params['action'];
     if (!empty($controller->params['data'])) {
         $controller->data =& $controller->params['data'];
     } else {
         $controller->data = null;
     }
     if (!empty($controller->params['pass'])) {
         $controller->passed_args =& $controller->params['pass'];
         $controller->passedArgs =& $controller->params['pass'];
     } else {
         $controller->passed_args = null;
         $controller->passedArgs = null;
     }
     if (!empty($params['bare'])) {
         $controller->autoLayout = !$params['bare'];
     } else {
         $controller->autoLayout = $controller->autoLayout;
     }
     $controller->webservices = $params['webservices'];
     $controller->plugin = $this->plugin;
     if (!is_null($controller->webservices)) {
         array_push($controller->components, $controller->webservices);
         array_push($controller->helpers, $controller->webservices);
         $component =& new Component($controller);
     }
     $controller->_initComponents();
     $controller->constructClasses();
     if ($missingAction && !in_array('scaffold', array_keys($classVars))) {
         $this->start($controller);
         return $this->cakeError('missingAction', array(array('className' => Inflector::camelize($params['controller'] . "Controller"), 'action' => $params['action'], 'webroot' => $this->webroot, 'url' => $url, 'base' => $this->base)));
     }
     if ($privateAction) {
         $this->start($controller);
         return $this->cakeError('privateAction', array(array('className' => Inflector::camelize($params['controller'] . "Controller"), 'action' => $params['action'], 'webroot' => $this->webroot, 'url' => $url, 'base' => $this->base)));
     }
     return $this->_invoke($controller, $params, $missingAction);
 }
Esempio n. 24
0
const BASE_PATH = '/api/';
try {
    //remove the base path
    $path = str_replace(BASE_PATH, '', $_SERVER['REQUEST_URI']);
    //split the url in path elements
    $url_elements = explode('/', $path);
    //the first parameter is used as controller
    $controller_name = @array_shift($url_elements);
    if (preg_match('/[^a-z]{3,}/i', $controller_name)) {
        //prevent path transversial
        throw new Exception("Invalid path", 400);
    }
    $requestMethod = strtolower($_SERVER['REQUEST_METHOD']) . 'Action';
    //load the file
    loadController($controller_name);
    $controller_class = $controller_name . 'Controller';
    $controller = new $controller_class();
    if (!method_exists($controller, $requestMethod)) {
        throw new Exception("Invalid request method", 400);
    }
    $controller->{$requestMethod}($url_elements);
} catch (Exception $ex) {
    http_response_code($ex->getCode());
    //provide the message in json fromat in order to make it readable for the client
    die(json_encode($ex->getMessage()));
}
function loadController($controller_name)
{
    $path = __DIR__ . "/controller/" . $controller_name . ".php";
    if (file_exists($path)) {
<?php

loadController('OrderItems');
class OrderItemsControllerTestCase extends CakeTestCase
{
    var $TestObject = null;
    function setUp()
    {
        $this->TestObject = new OrderItemsController();
    }
    function tearDown()
    {
        unset($this->TestObject);
    }
}
<?php

loadController('Currencies');
class CurrenciesControllerTestCase extends UnitTestCase
{
    var $TestObject = null;
    function setUp()
    {
        $this->TestObject = new CurrenciesController();
    }
    function tearDown()
    {
        unset($this->TestObject);
    }
}
<?php

loadController('Assets');
class AssetsControllerTestCase extends UnitTestCase
{
    var $object = null;
    function setUp()
    {
        $this->object = new AssetsController();
    }
    function tearDown()
    {
        unset($this->object);
    }
}
<?php

loadController('Categories');
class CategoriesControllerTestCase extends CakeTestCase
{
    var $TestObject = null;
    function setUp()
    {
        $this->TestObject = new CategoriesController();
    }
    function tearDown()
    {
        unset($this->TestObject);
    }
}
Esempio n. 29
0
/**
 * Loads all controllers.
 */
function loadControllers()
{
    $paths = Configure::getInstance();
    if (!class_exists('AppController')) {
        if (file_exists(APP . 'app_controller.php')) {
            require APP . 'app_controller.php';
        } else {
            require CAKE . 'app_controller.php';
        }
    }
    $loadedControllers = array();
    foreach ($paths->controllerPaths as $path) {
        foreach (listClasses($path) as $controller) {
            list($name) = explode('.', $controller);
            $className = Inflector::camelize(str_replace('_controller', '', $name));
            if (loadController($className)) {
                $loadedControllers[$controller] = $className;
            }
        }
    }
    return $loadedControllers;
}
<?php

loadController('Lancamentos');
class LancamentosControllerTestCase extends UnitTestCase
{
    var $object = null;
    function setUp()
    {
        $this->object = new LancamentosController();
    }
    function tearDown()
    {
        unset($this->object);
    }
}