error_reporting(E_ALL); if (!defined('TEST_INITIALIZED')) { // load classes and mount paths $cd = getcwd(); $_SERVER["SCRIPT_FILENAME"] = dirname(__FILE__); chdir(dirname(dirname(__FILE__))); chdir('..'); include_once 'application/Initialize.php'; $arPath = realpath(getcwd() . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'activerecord' . DIRECTORY_SEPARATOR . 'ActiveRecord.php'); include_once $arPath; ActiveRecord::setDSN('mysql://root@server/livecart'); // set unittest and simpletest library root directory $libDir = dirname(dirname(__FILE__)) . '/_library/'; ClassLoader::mountPath('phpunit', realpath($libDir . 'phpunit/')); ClassLoader::mountPath('unittest', realpath($libDir . 'unittest') . '/'); ClassLoader::mountPath('testdir', dirname(__FILE__) . '/'); ClassLoader::import("phpunit.*"); ClassLoader::import("unittest.*"); ClassLoader::import("testdir.*"); ClassLoader::import('unittest.UnitTest'); chdir($cd); define('TEST_INITIALIZED', true); ClassLoader::import('application.LiveCart'); UnitTest::setApplication(new LiveCart()); UnitTest::getApplication()->getConfig()->setAutoSave(false); UnitTest::getApplication()->getConfig()->set('EMAIL_METHOD', 'FAKE'); } ClassLoader::import('application.system.*'); ClassLoader::import('library.locale.Locale'); ClassLoader::import('test.mock.Swift_Connection_Fake'); require_once 'LiveCartTest.php';
$stat = $_REQUEST['stat']; } $start = microtime(true); ClassLoader::load($className); $elapsed = microtime(true) - $start; if (empty($GLOBALS['ClassLoaderTime'])) { $GLOBALS['ClassLoaderTime'] = $GLOBALS['ClassLoaderCount'] = 0; } $GLOBALS['ClassLoaderTime'] += $elapsed; $GLOBALS['ClassLoaderCount']++; } } require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'framework' . DIRECTORY_SEPARATOR . 'ClassLoader.php'; ClassLoader::mountPath('.', dirname(dirname($_SERVER["SCRIPT_FILENAME"])) . DIRECTORY_SEPARATOR); if (defined('CACHE_DIR')) { ClassLoader::mountPath('cache', CACHE_DIR); } $classLoaderCacheFile = ClassLoader::getRealPath('cache.') . 'classloader.php'; if (file_exists($classLoaderCacheFile)) { $classLoaderCache = (include $classLoaderCacheFile); ClassLoader::setRealPathCache($classLoaderCache['realPath']); ClassLoader::setMountPointCache($classLoaderCache['mountPoint']); } if (isset($_REQUEST['stat'])) { ClassLoader::import('library.stat.Stat'); $stat = new Stat(true); $GLOBALS['stat'] = $stat; } ClassLoader::import('framework.request.Request'); ClassLoader::import('framework.request.Router'); ClassLoader::import('framework.controller.*');
<?php /** * Integry framework bootstrap * * @package framework * @author Integry Systems * */ require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ClassLoader.php'; // we're assuming that application root is one level above the framework directory // if it's not the case, call ClassLoader::mountPath('.', '/path/to/the/root/directory'); ClassLoader::mountPath('.', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR); ClassLoader::mountPath('framework', dirname(__FILE__) . DIRECTORY_SEPARATOR); ClassLoader::import('framework.request.*'); ClassLoader::import('framework.renderer.*'); ClassLoader::import('framework.response.*'); ClassLoader::import('framework.controller.*'); ClassLoader::import('framework.Application'); $app = new Application(); // initialize default routing rules $router = $app->getRouter(); $rules = array(array(":controller", array("action" => "index"), array()), array(":controller/:id", array("action" => "index"), array("id" => "-?[0-9]+")), array(":controller/:action", array(), array()), array(":controller/:action/:id", array(), array("id" => "-?[0-9]+"))); foreach ($rules as $route) { $router->connect($route[0], $route[1], $route[2]); } return $app;