本文整理汇总了PHP中lithium\core\Libraries::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Libraries::add方法的具体用法?PHP Libraries::add怎么用?PHP Libraries::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lithium\core\Libraries
的用法示例。
在下文中一共展示了Libraries::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
public function tearDown()
{
$_SERVER = $this->_backup['_SERVER'];
chdir($this->_backup['cwd']);
Libraries::add('app', $this->_backup['app']);
$this->_cleanUp();
}
示例2: testConfig
public function testConfig()
{
$oldConfig = Libraries::get('li3_facebook');
Libraries::remove('li3_facebook');
Libraries::add('li3_facebook');
FacebookProxy::$_autoConfigure = false;
FacebookProxy::__init();
$this->assertEqual(FacebookProxy::config(), array(), 'config should be empty.');
$this->assertEqual(FacebookProxy::config(array()), array(), 'config should be empty.');
//check ignoring
FacebookProxy::reset();
$result = FacebookProxy::config(array('foo'));
$this->assertTrue($result, array(), 'config should return true');
$this->assertIdentical(FacebookProxy::config(), array(), 'config should be empty');
//check ingoring vs. existing but unset associations
FacebookProxy::reset();
$result = FacebookProxy::config(array('appId'));
$this->assertTrue($result, array(), 'config should return true');
$this->assertIdentical(FacebookProxy::config(), array(), 'config should be empty');
//check valid Settings
FacebookProxy::reset();
$sampleConfig = array('appId' => 'hello');
$result = FacebookProxy::config($sampleConfig);
$this->assertTrue($result, 'config should return true');
$this->assertIdentical(FacebookProxy::config(), $sampleConfig, 'config should not be empty');
//check vs. complete Settings
FacebookProxy::reset();
$result = FacebookProxy::config($this->_mockDefaults);
$this->assertTrue($result, 'config should return true');
$this->assertIdentical(FacebookProxy::config(), $this->_mockDefaults, 'config should not be empty');
Libraries::remove('li3_facebook');
Libraries::add('li3_facebook', $oldConfig);
//FaceBookProxy::foo();
//die(print_r(array($result,FacebookProxy::config()),true));
}
示例3: setUp
public function setUp() {
$this->_backup['cwd'] = getcwd();
$this->_backup['_SERVER'] = $_SERVER;
$_SERVER['argv'] = array();
chdir($this->_testPath);
Libraries::add('library_test', array(
'path' => $this->_testPath . '/library_test', 'bootstrap' => false
));
Libraries::add('library_test_plugin', array(
'path' => $this->_testPath . '/library_test_plugin'
));
$this->classes = array(
'service' => 'lithium\tests\mocks\console\command\MockLibraryService',
'response' => 'lithium\tests\mocks\console\MockResponse'
);
$this->request = new Request(array('input' => fopen('php://temp', 'w+')));
$this->library = new Library(array(
'request' => $this->request, 'classes' => $this->classes
));
$this->testConf = $this->library->conf = $this->_testPath . '/library.json';
}
示例4: renderer
/**
* instantiates and returns instance of neon-renderer
*
* @return object instance of NeonRenderer
*/
public static function renderer()
{
if (is_null(static::$_renderer)) {
Libraries::add('Neon', array('path' => RADIUM_PATH . '/libraries/neon'));
static::$_renderer = new NeonRenderer();
}
return static::$_renderer;
}
示例5: tearDown
public function tearDown()
{
foreach ($this->_superglobals as $varname) {
$GLOBALS[$varname] = $this->_env[$varname];
}
Libraries::remove('app');
Libraries::add($this->_library['name'], $this->_library);
$this->_cleanUp();
}
示例6: testShouldRunSetsLibraryConfig
public function testShouldRunSetsLibraryConfig()
{
$config = $this->selfConfig;
unset($config['shouldRun']);
Libraries::add('li3_newrelic', $this->selfConfig);
$result = NewrelicMock::shouldRun();
$config = Libraries::get('li3_newrelic');
$this->assertArrayHasKey('shouldRun', $config);
$this->assertInternalType('bool', $result);
}
示例7: setUp
public function setUp()
{
$this->_backup['cwd'] = getcwd();
$this->_backup['_SERVER'] = $_SERVER;
$_SERVER['argv'] = array();
Libraries::add('create_test', array('path' => $this->_testPath . '/create_test'));
$this->request = new Request(array('input' => fopen('php://temp', 'w+')));
$this->request->params = array('library' => 'create_test', 'action' => null);
Connections::add('default', array('type' => null, 'adapter' => 'lithium\\tests\\mocks\\data\\model\\MockDatabase'));
}
示例8: setUp
public function setUp()
{
$this->classes = array('response' => 'lithium\\tests\\mocks\\console\\MockResponse');
$this->_backup['cwd'] = getcwd();
$this->_backup['_SERVER'] = $_SERVER;
$_SERVER['argv'] = array();
Libraries::add('create_test', array('path' => $this->_testPath . '/create_test'));
$this->request = new Request(array('input' => fopen('php://temp', 'w+')));
$this->request->params = array('library' => 'create_test');
}
示例9: shouldRun
/**
*
* Determines if we should run any `newrelic_` methods.
*
* If the configuration for the plugin `shouldRun` does not exist, set
* a generic one.
*
* @return bool
*/
public static function shouldRun()
{
if (!is_callable(Libraries::get('li3_newrelic', 'shouldRun'))) {
$config = Libraries::get('li3_newrelic');
$config['shouldRun'] = function () {
return Environment::is('production') && extension_loaded('newrelic');
};
Libraries::add('li3_newrelic', $config);
}
return Libraries::get('li3_newrelic', 'shouldRun')->__invoke();
}
示例10: testEmptyConfig
public function testEmptyConfig()
{
$oldConfig = Libraries::get('li3_facebook');
$subject = new Facebook();
//disable validation inside the proxy
FacebookProxy::$_validateConfiguration = false;
Libraries::remove('li3_facebook');
Libraries::add('li3_facebook');
$this->expectException('Configuration: `appId` should be set');
$this->assertTrue($subject->check($this->request));
Libraries::remove('li3_facebook');
Libraries::add('li3_facebook', $oldConfig);
}
示例11: setUp
public function setUp()
{
$this->_backup['cwd'] = getcwd();
$this->_backup['_SERVER'] = $_SERVER;
$_SERVER['argv'] = array();
$this->_testPath = LITHIUM_APP_PATH . '/resources/tmp/tests';
chdir($this->_testPath);
Libraries::add('library_test', array('path' => $this->_testPath . '/library_test'));
Libraries::add('plugin', array('library_test_plugin' => array('path' => $this->_testPath . '/library_test_plugin')));
$this->classes = array('service' => '\\lithium\\tests\\mocks\\console\\command\\MockLibraryService', 'response' => '\\lithium\\tests\\mocks\\console\\MockResponse');
$this->request = new Request(array('input' => fopen('php://temp', 'w+')));
$this->library = new Library(array('request' => $this->request, 'classes' => $this->classes));
$this->library->conf = $this->_conf = $this->_testPath . '/library.json';
}
示例12: array
<?php
/**
* Lithium: the most rad php framework
*
* @copyright Copyright 2009, Union of RAD (http://union-of-rad.org)
* @license http://opensource.org/licenses/bsd-license.php The BSD License
*/
use lithium\core\Libraries;
/**
* Add the `phpca` library.
*/
Libraries::add('phpca', array('prefix' => 'spriebsch\\PHPca\\', 'path' => dirname(__DIR__) . '/libraries/phpca/src', 'bootstrap' => 'Autoload.php'));
示例13: ErrorException
<?php
define('LITHIUM_LIBRARY_PATH', 'phar://lithium.phar');
if (!(include LITHIUM_LIBRARY_PATH . '/lithium/core/Libraries.php')) {
$message = "Lithium core could not be found. Check the value of LITHIUM_LIBRARY_PATH.";
throw new ErrorException($message);
}
use lithium\core\Libraries;
Libraries::add('lithium');
示例14: array
require LITHIUM_LIBRARY_PATH . '/lithium/net/http/Message.php';
require LITHIUM_LIBRARY_PATH . '/lithium/net/http/Media.php';
require LITHIUM_LIBRARY_PATH . '/lithium/net/http/Request.php';
require LITHIUM_LIBRARY_PATH . '/lithium/net/http/Response.php';
require LITHIUM_LIBRARY_PATH . '/lithium/net/http/Route.php';
require LITHIUM_LIBRARY_PATH . '/lithium/net/http/Router.php';
require LITHIUM_LIBRARY_PATH . '/lithium/action/Controller.php';
require LITHIUM_LIBRARY_PATH . '/lithium/action/Dispatcher.php';
require LITHIUM_LIBRARY_PATH . '/lithium/action/Request.php';
require LITHIUM_LIBRARY_PATH . '/lithium/action/Response.php';
require LITHIUM_LIBRARY_PATH . '/lithium/template/View.php';
require LITHIUM_LIBRARY_PATH . '/lithium/template/view/Renderer.php';
require LITHIUM_LIBRARY_PATH . '/lithium/template/view/Compiler.php';
require LITHIUM_LIBRARY_PATH . '/lithium/template/view/adapter/File.php';
require LITHIUM_LIBRARY_PATH . '/lithium/storage/Cache.php';
require LITHIUM_LIBRARY_PATH . '/lithium/storage/cache/adapter/Apc.php';
/**
* Add the Lithium core library. This sets default paths and initializes the autoloader. You
* generally should not need to override any settings.
*/
Libraries::add('lithium');
/**
* Add the application. You can pass a `'path'` key here if this bootstrap file is outside of
* your main application, but generally you should not need to change any settings.
*/
Libraries::add('app', array('default' => true));
/**
* Add some plugins
*/
Libraries::add('li3_twig', array('bootstrap' => true));
示例15: array
require LITHIUM_LIBRARY_PATH . '/lithium/net/http/Route.php';
require LITHIUM_LIBRARY_PATH . '/lithium/net/http/Router.php';
require LITHIUM_LIBRARY_PATH . '/lithium/action/Controller.php';
require LITHIUM_LIBRARY_PATH . '/lithium/action/Dispatcher.php';
require LITHIUM_LIBRARY_PATH . '/lithium/action/Request.php';
require LITHIUM_LIBRARY_PATH . '/lithium/action/Response.php';
require LITHIUM_LIBRARY_PATH . '/lithium/template/View.php';
require LITHIUM_LIBRARY_PATH . '/lithium/template/view/Renderer.php';
require LITHIUM_LIBRARY_PATH . '/lithium/template/view/Compiler.php';
require LITHIUM_LIBRARY_PATH . '/lithium/template/view/adapter/File.php';
require LITHIUM_LIBRARY_PATH . '/lithium/storage/Cache.php';
require LITHIUM_LIBRARY_PATH . '/lithium/storage/cache/adapter/Apc.php';
/**
* Add the Lithium core library. This sets default paths and initializes the autoloader. You
* generally should not need to override any settings.
*/
Libraries::add('lithium');
/**
* Add the application. You can pass a `'path'` key here if this bootstrap file is outside of
* your main application, but generally you should not need to change any settings.
*/
Libraries::add('app', array('default' => true));
/**
* Add some plugins:
*/
//Libraries::add('li3_show');
Libraries::add('li3_qrcode');
Libraries::add('li3_pdf');
Libraries::add('jpgraph', array('bootstrap' => 'jpgraph_required.php'));
Libraries::add('swiftmailer', array('bootstrap' => 'swift_required.php'));