本文整理汇总了PHP中App::build方法的典型用法代码示例。如果您正苦于以下问题:PHP App::build方法的具体用法?PHP App::build怎么用?PHP App::build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App
的用法示例。
在下文中一共展示了App::build方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
parent::setUp();
App::build(array('Plugin' => array(CakePlugin::path('Extensions') . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)), App::PREPEND);
$this->CroogoPlugin = new CroogoPlugin();
$this->_mapping = array(1346748762 => array('version' => 1346748762, 'name' => '1346748762_first', 'class' => 'First', 'type' => 'app', 'migrated' => '2012-09-04 10:52:42'), 1346748933 => array('version' => 1346748933, 'name' => '1346748933_addstatus', 'class' => 'AddStatus', 'type' => 'app', 'migrated' => '2012-09-04 10:55:33'));
}
示例2: run
/**
+----------------------------------------------------------
* 应用程序初始化
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @return void
+----------------------------------------------------------
*/
public static function run()
{
// 设定错误和异常处理
set_error_handler(array('App', "appError"));
set_exception_handler(array('App', "appException"));
//[RUNTIME]
// 检查项目是否编译过
// 在部署模式下会自动在第一次执行的时候编译项目
if (defined('RUNTIME_MODEL')) {
// 运行模式无需载入项目编译缓存
} elseif (is_file(RUNTIME_PATH . '~app.php')) {
// 直接读取编译后的项目文件
C(include RUNTIME_PATH . '~app.php');
} else {
// 预编译项目
App::build();
}
//[/RUNTIME]
// 取得模块和操作名称
define('MODULE_NAME', isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : C('DEFAULT_MODULE'));
define('ACTION_NAME', isset($_SERVER['argv'][2]) ? $_SERVER['argv'][2] : C('DEFAULT_ACTION'));
// 执行操作
R(MODULE_NAME, ACTION_NAME);
// 保存日志记录
if (C('LOG_RECORD')) {
Log::save();
}
return;
}
示例3: testRenderWithView
/**
* testRenderWithView method
*
* @return void
*/
public function testRenderWithView() {
App::build(array(
'View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)
));
$Request = new CakeRequest(null, false);
$Request->params['named'] = array('page' => 2);
$Response = new CakeResponse();
$Controller = new Controller($Request, $Response);
$Controller->name = $Controller->viewPath = 'Posts';
$data = array(
'User' => array(
'username' => 'fake'
),
'Item' => array(
array('name' => 'item1'),
array('name' => 'item2')
)
);
$Controller->set('user', $data);
$View = new JsonView($Controller);
$View->helpers = array('Paginator');
$output = $View->render('index');
$expected = json_encode(array('user' => 'fake', 'list' => array('item1', 'item2'), 'paging' => array('page' => 2)));
$this->assertSame($expected, $output);
$this->assertSame('application/json', $Response->type());
}
示例4: testThemeAndPluginInclusion
public function testThemeAndPluginInclusion()
{
App::build(array('Plugin' => array($this->_testFiles . 'Plugin' . DS), 'View' => array($this->_testFiles . 'View' . DS)));
CakePlugin::load('TestAsset');
$settings = array('paths' => array(), 'theme' => 'Red');
$this->filter->settings($settings);
$this->_themeDir = $this->_testFiles . DS . 'View' . DS . 'Themed' . DS . $settings['theme'] . DS;
$content = file_get_contents($this->_themeDir . 'webroot' . DS . 'theme.js');
$result = $this->filter->input('theme.js', $content);
$expected = <<<TEXT
var Theme = new Class({
});
var ThemeInclude = new Class({
});
var Plugin = new Class({
});
TEXT;
$this->assertTextEquals($expected, $result);
}
示例5: setUp
public function setUp()
{
parent::setUp();
App::build(['Model' => [CakePlugin::path('Tools') . 'Test' . DS . 'test_app' . DS . 'Model' . DS]], App::RESET);
$this->Comment = ClassRegistry::init('BitmaskedComment');
$this->Comment->Behaviors->load('Tools.Bitmasked', ['mappedField' => 'statuses']);
}
示例6: __construct
/**
* __construct
*
* @param object $request
* @param object $response
*/
public function __construct($request = null, $response = null)
{
parent::__construct($request, $response);
App::uses('OvenConfig', 'Oven.Lib');
new OvenConfig();
App::build(array('View' => array(App::pluginPath('Oven') . 'Lib' . DS . 'View' . DS)), App::PREPEND);
}
示例7: startCase
/**
* start Case - switch view paths
*
* @return void
**/
function startCase()
{
$this->_viewPaths = App::build('views');
App::build(array('views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS, APP . 'plugins' . DS . 'debug_kit' . DS . 'views' . DS, ROOT . DS . LIBS . 'view' . DS)), true);
$this->_debug = Configure::read('debug');
$this->firecake =& FireCake::getInstance();
}
示例8: setUp
/**
* Sets the plugins folder for this test
*
* @return void
*/
public function setUp() {
parent::setUp();
App::build(array(
'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)
), App::RESET);
App::objects('plugins', null, false);
}
示例9: bootstrap
/**
* Initializes configure and runs the bootstrap process.
* Bootstrapping includes the following steps:
*
* - Setup App array in Configure.
* - Include app/Config/core.php.
* - Configure core cache configurations.
* - Load App cache files.
* - Include app/Config/bootstrap.php.
* - Setup error/exception handlers.
*
* @param bool $boot Whether to do bootstrapping.
*
* @return void
*/
public static function bootstrap($boot = TRUE)
{
if ($boot) {
static::_appDefaults();
if (!(include APP . 'Config' . DS . 'core.php')) {
trigger_error(__d('cake_dev', "Can't find application core file. Please create %s, and make sure it is readable by PHP.", APP . 'Config' . DS . 'core.php'), E_USER_ERROR);
}
App::init();
App::$bootstrapping = FALSE;
App::build();
$exception = array('handler' => 'ErrorHandler::handleException');
$error = array('handler' => 'ErrorHandler::handleError', 'level' => E_ALL & ~E_DEPRECATED);
if (PHP_SAPI === 'cli') {
App::uses('ConsoleErrorHandler', 'Console');
$console = new ConsoleErrorHandler();
$exception['handler'] = array($console, 'handleException');
$error['handler'] = array($console, 'handleError');
}
static::_setErrorHandlers($error, $exception);
if (!(include APP . 'Config' . DS . 'bootstrap.php')) {
trigger_error(__d('cake_dev', "Can't find application bootstrap file. Please create %s, and make sure it is readable by PHP.", APP . 'Config' . DS . 'bootstrap.php'), E_USER_ERROR);
}
restore_error_handler();
static::_setErrorHandlers(static::$_values['Error'], static::$_values['Exception']);
// Preload Debugger + CakeText in case of E_STRICT errors when loading files.
if (static::$_values['debug'] > 0) {
class_exists('Debugger');
class_exists('CakeText');
}
}
}
示例10: setUp
/**
* setUp method
*/
public function setUp()
{
parent::setUp();
App::build(array('Plugin' => array(CakePlugin::path('Migrations') . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)), APP::RESET);
$this->connection = 'test';
$this->Migrations = new Migrations($this->connection);
}
示例11: setUp
public function setUp()
{
App::build(array('View' => array(App::pluginPath('Asset') . 'Test' . DS . 'test_app' . DS . 'View' . DS), 'Plugin' => array(App::pluginPath('Asset') . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS)), App::RESET);
$this->path = App::pluginPath('Asset') . 'Test' . DS . 'test_app' . DS . 'webroot' . DS;
$this->file = $this->path . 'css' . DS . 'default.css';
$this->Asset = new CssAsset('css/default.css', $this->file, $this->path);
}
示例12: setUp
public function setUp() {
parent::setUp();
$this->_pluginPath = App::pluginPath('AssetCompress');
$this->testConfig = $this->_pluginPath . 'Test' . DS . 'test_files' . DS . 'Config' . DS . 'integration.ini';
$map = array(
'TEST_FILES/' => $this->_pluginPath . 'Test' . DS . 'test_files' . DS
);
App::build(array(
'Plugin' => array($map['TEST_FILES/'] . 'Plugin' . DS )
));
CakePlugin::load('TestAssetIni');
AssetConfig::clearAllCachedKeys();
$config = AssetConfig::buildFromIniFile($this->testConfig, $map);
$config->filters('js', null, array());
$this->Compressor = $this->getMock('AssetCompressor', array('_getConfig'));
$this->Compressor->expects($this->atLeastOnce())
->method('_getConfig')
->will($this->returnValue($config));
$this->request = new CakeRequest(null, false);
$this->response = $this->getMock('CakeResponse', array('checkNotModified', 'type', 'send'));
Configure::write('debug', 2);
}
示例13: testReadPluginValue
/**
* test reading from plugins
*
* @return void
*/
function testReadPluginValue()
{
App::build(array('plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)), true);
$reader = new PhpReader($this->path);
$result = $reader->read('TestPlugin.load');
$this->assertTrue(isset($result['plugin_load']));
}
示例14: bootstrap
/**
* Initializes configure and runs the bootstrap process.
* Bootstrapping includes the following steps:
*
* - Setup App array in Configure.
* - Include app/Config/core.php.
* - Configure core cache configurations.
* - Load App cache files.
* - Include app/Config/bootstrap.php.
* - Setup error/exception handlers.
*
* @param boolean $boot
* @return void
*/
public static function bootstrap($boot = true)
{
if ($boot) {
self::write('App', array('base' => false, 'baseUrl' => false, 'dir' => APP_DIR, 'webroot' => WEBROOT_DIR, 'www_root' => WWW_ROOT));
if (!(include APP . 'Config' . DS . 'core.php')) {
trigger_error(__d('cake_dev', "Can't find application core file. Please create %score.php, and make sure it is readable by PHP.", APP . 'Config' . DS), E_USER_ERROR);
}
App::$bootstrapping = false;
App::init();
App::build();
if (!(include APP . 'Config' . DS . 'bootstrap.php')) {
trigger_error(__d('cake_dev', "Can't find application bootstrap file. Please create %sbootstrap.php, and make sure it is readable by PHP.", APP . 'Config' . DS), E_USER_ERROR);
}
$level = -1;
if (isset(self::$_values['Error']['level'])) {
error_reporting(self::$_values['Error']['level']);
$level = self::$_values['Error']['level'];
}
if (!empty(self::$_values['Error']['handler'])) {
set_error_handler(self::$_values['Error']['handler'], $level);
}
if (!empty(self::$_values['Exception']['handler'])) {
set_exception_handler(self::$_values['Exception']['handler']);
}
}
}
示例15: beforeFilter
public function beforeFilter()
{
$this->Cookie->httpOnly = true;
/*Configure Path*/
App::build(array('Model' => array(CAKE_CORE_INCLUDE_PATH . '/Model/Base/', CAKE_CORE_INCLUDE_PATH . '/Model/', APP_DIR . '/Model/', CAKE_CORE_INCLUDE_PATH . '/Model/Form/'), 'Lib' => array(CAKE_CORE_INCLUDE_PATH . '/Lib/'), 'Vendor' => array(CAKE_CORE_INCLUDE_PATH . '/Vendor/')));
/*Autoload Model*/
App::import('Model', array('CommonTable'));
/*Autoload Lib*/
App::uses('myTools', 'Lib');
App::uses('myMailer', 'Lib');
App::uses('myError', 'Lib');
/*Autoload table class*/
spl_autoload_register(function ($class) {
$classFile1 = CAKE_CORE_INCLUDE_PATH . '/Model/' . $class . '.php';
$classFile2 = CAKE_CORE_INCLUDE_PATH . '/Model/Form/' . $class . '.php';
if (is_file($classFile1)) {
require_once $classFile1;
}
if (is_file($classFile2)) {
require_once $classFile2;
}
});
/*Autoload Lib*/
Configure::load('my');
Configure::load('const');
}