本文整理汇总了PHP中Kwf_Component_Data_Root::setComponentClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Kwf_Component_Data_Root::setComponentClass方法的具体用法?PHP Kwf_Component_Data_Root::setComponentClass怎么用?PHP Kwf_Component_Data_Root::setComponentClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kwf_Component_Data_Root
的用法示例。
在下文中一共展示了Kwf_Component_Data_Root::setComponentClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
Kwf_Component_Data_Root::setComponentClass(false);
if (!`which rrdtool`) {
$this->markTestSkipped();
}
}
示例2: setUp
public function setUp()
{
parent::setUp();
Kwf_Model_Abstract::getInstance('Kwf_Form_MultiFields_TestModel1')->setData(array(array('id' => 1, 'blub' => 'blub0'), array('id' => 2, 'blub' => 'blub1'), array('id' => 3, 'blub' => 'blub2')));
Kwf_Model_Abstract::getInstance('Kwf_Form_MultiFields_TestModel2')->setData(array(array('id' => 1, 'model1_id' => 1, 'foo' => 'foo0', 'bar' => 'bar0', 'pos' => 1), array('id' => 2, 'model1_id' => 1, 'foo' => 'foo1', 'bar' => 'bar1', 'pos' => 2), array('id' => 3, 'model1_id' => 2, 'foo' => 'foo2', 'bar' => 'bar2', 'pos' => 1), array('id' => 4, 'model1_id' => 3, 'foo' => 'foo0', 'pos' => 1), array('id' => 5, 'model1_id' => 3, 'foo' => 'foo1', 'pos' => 2), array('id' => 6, 'model1_id' => 3, 'foo' => 'foo2', 'pos' => 3)));
Kwf_Component_Data_Root::setComponentClass(false);
//damit ModelObserver nichts macht
}
示例3: _setup
private function _setup($rootClass)
{
Kwf_Component_Data_Root::setComponentClass($rootClass);
$this->_root = Kwf_Component_Data_Root::getInstance();
Kwf_Component_Cache::setInstance(Kwf_Component_Cache::CACHE_BACKEND_FNF);
Kwf_Cache::factory('Core', 'Memcached', array('lifetime' => null, 'automatic_cleaning_factor' => false, 'automatic_serialization' => true))->clean();
Kwf_Cache_Simple::resetZendCache();
}
示例4: initForTests
public static function initForTests()
{
Kwf_Session::start();
Kwf_Util_MemoryLimit::set(512);
Kwf_Component_Data_Root::setComponentClass(false);
Zend_Registry::set('db', Kwf_Test::getTestDb());
set_time_limit(0);
Kwf_Benchmark::disable();
}
示例5: setUp
public function setUp()
{
if (!Kwf_Registry::get('config')->amazon || !Kwf_Registry::get('config')->amazon->key) {
$this->markTestSkipped();
}
Kwf_Component_Data_Root::setComponentClass('Kwc_Advanced_Amazon_Nodes_Root');
$this->_root = Kwf_Component_Data_Root::getInstance();
parent::setUp();
}
示例6: indexAction
public function indexAction()
{
Zend_Registry::set('db', false);
Kwf_Test_SeparateDb::setDbFromCookie();
// setzt es nur wenn es das cookie wirklich gibt
//FnF models setzen damit tests nicht in echte tabellen schreiben
Kwf_Component_Cache::setInstance(Kwf_Component_Cache::CACHE_BACKEND_FNF);
Kwf_Component_Cache_Memory::setInstance(new Kwf_Component_Cache_MemoryBlackHole());
/*
if (class_exists('APCIterator')) {
$prefix = Kwf_Cache::getUniquePrefix();
apc_delete_file(new APCIterator('user', '#^'.$prefix.'#'));
} else {
apc_clear_cache('user');
}
*/
Kwf_Component_Data_Root::setComponentClass($this->_getParam('root'));
Zend_Registry::set('testRootComponentClass', $this->_getParam('root'));
$root = Kwf_Component_Data_Root::getInstance();
$root->setFilename('kwf/kwctest/' . $this->_getParam('root'));
$url = $this->_getParam('url');
$urlParts = explode('/', $url);
if (is_array($urlParts) && $urlParts[0] == 'media') {
if (sizeof($urlParts) != 7) {
throw new Kwf_Exception_NotFound();
}
$class = $urlParts[1];
$id = $urlParts[2];
$type = $urlParts[3];
$checksum = $urlParts[4];
// time() wäre der 5er, wird aber nur wegen browsercache benötigt
$filename = $urlParts[6];
if ($checksum != Kwf_Media::getChecksum($class, $id, $type, $filename)) {
throw new Kwf_Exception_AccessDenied('Access to file not allowed.');
}
Kwf_Media_Output::output(Kwf_Media::getOutput($class, $id, $type));
}
if ($url == 'kwf/util/kwc/render') {
if (isset($_REQUEST['url'])) {
$_REQUEST['url'] = str_replace('/' . $root->filename, '', $_REQUEST['url']);
}
Kwf_Util_Component::dispatchRender();
}
$domain = 'http://' . Zend_Registry::get('config')->server->domain;
$data = $root->getPageByUrl($domain . Kwf_Setup::getBaseUrl() . '/' . $url, null);
if (!$data) {
throw new Kwf_Exception_NotFound();
}
$root->setCurrentPage($data);
$contentSender = Kwc_Abstract::getSetting($data->componentClass, 'contentSender');
$contentSender = new $contentSender($data);
$contentSender->sendContent(true);
Kwf_Benchmark::shutDown();
Kwf_Benchmark::output();
exit;
}
示例7: fromUrlParameter
public static function fromUrlParameter($class, $parameter)
{
$param = explode(':', $parameter);
$testDependenciesIni = $param[0];
$rootComponentClass = $param[1];
if ($rootComponentClass) {
Kwf_Component_Data_Root::setComponentClass($rootComponentClass);
}
return new $class($testDependenciesIni, $param[2]);
}
示例8: setUp
public function setUp()
{
parent::setUp();
//clear view cache
Kwf_Cache::factory('Core', 'Memcached', array('lifetime' => null, 'automatic_cleaning_factor' => false, 'automatic_serialization' => true))->clean();
Kwf_Cache_Simple::resetZendCache();
Kwf_Component_Data_Root::setComponentClass('Kwc_FavouritesSelenium_Root');
//use custom user model
$this->presetModel = Kwf_Registry::get('config')->user->model;
Kwf_Registry::get('config')->user->model = 'Kwc_FavouritesSelenium_UserModel';
//unset existing userModel instance to get new one
$reg = Kwf_Registry::getInstance()->set('userModel', Kwf_Model_Abstract::getInstance('Kwc_FavouritesSelenium_UserModel'));
}
示例9: setUp
public function setUp()
{
Kwf_Component_Data_Root::setComponentClass(false);
Kwf_Component_Cache::setInstance(Kwf_Component_Cache::CACHE_BACKEND_FNF);
Kwf_Events_ModelObserver::getInstance()->setSkipFnF(false);
//clear cache as tests use new upload ids
$dir = Kwf_Config::getValue('uploads') . "/mediaprescale";
if (file_exists($dir)) {
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST) as $path) {
$path->isFile() ? unlink($path->getPathname()) : rmdir($path->getPathname());
}
}
}
示例10: _init
protected function _init($componentClass)
{
Kwf_Component_Data_Root::setComponentClass($componentClass);
Zend_Session::$_unitTestEnabled = true;
$this->_root = Kwf_Component_Data_Root::getInstance();
$this->_root->setFilename('kwf/kwctest/' . $componentClass);
if (function_exists('apc_clear_cache')) {
apc_clear_cache('user');
}
Kwf_Component_Cache_Memory::getInstance()->_clean();
Kwf_Cache_Simple::resetZendCache();
Kwc_FulltextSearch_MetaModel::setInstance(new Kwf_Model_FnF(array('primaryKey' => 'page_id')));
Kwf_Assets_Package_Default::clearInstances();
Kwf_Component_LogDuplicateModel::setInstance(new Kwf_Model_FnF(array()));
Kwf_Media_MemoryCache::getInstance()->clean();
return $this->_root;
}
示例11: getControllerClass
public function getControllerClass(Zend_Controller_Request_Abstract $request)
{
$module = $request->getModuleName();
if ($module == 'component' && $request->getControllerName() == 'component' || $module == 'component_test' && $request->getControllerName() == 'component_test') {
if ($module == 'component_test') {
//FnF models setzen damit tests nicht in echte tabellen schreiben
Kwf_Component_Cache::setInstance(Kwf_Component_Cache::CACHE_BACKEND_FNF);
Kwf_Test_SeparateDb::setDbFromCookie();
// setzt es nur wenn es das cookie wirklich gibt
if (!Kwf_Loader::isValidClass($request->getParam('root'))) {
throw new Kwf_Exception_NotFound("Invalid root component");
}
Kwf_Component_Data_Root::setComponentClass($request->getParam('root'));
$root = Kwf_Component_Data_Root::getInstance();
$root->setFilename('kwf/kwctest/' . $request->getParam('root'));
Kwf_Registry::get('acl')->getComponentAcl()->allowComponent('guest', null);
//hick hack, für Kwf_Component_Abstract_Admin::getControllerUrl
Zend_Registry::set('testRootComponentClass', $request->getParam('root'));
}
$class = $request->getParam('class');
$controller = $request->getParam('componentController');
$controller .= 'Controller';
if ($controller == 'IndexController') {
$controller = 'Controller';
}
if (($pos = strpos($class, '!')) !== false) {
$controller = substr($class, $pos + 1) . 'Controller';
$class = substr($class, 0, $pos);
}
if (!in_array($class, Kwc_Abstract::getComponentClasses())) {
//unknown component class
return false;
}
$className = Kwc_Admin::getComponentClass($class, $controller);
if (!$className) {
return false;
}
class_exists($className);
//trigger autoloader
} else {
$className = parent::getControllerClass($request);
}
return $className;
}
示例12: testCached
public function testCached()
{
Kwf_Benchmark::enable();
Kwf_Benchmark::reset();
$d = Kwf_Registry::get('testDomain');
$c = $this->_root->getPageByUrl("http://{$d}/foo", null);
//uncached
$this->assertEquals('1', $c->componentId);
$this->assertEquals(1, Kwf_Benchmark::getCounterValue('componentDatas'));
$this->assertEquals(0, (int) Kwf_Benchmark::getCounterValue('unserialized componentDatas'));
Kwf_Component_Data_Root::reset();
Kwf_Component_Data_Root::setComponentClass('Kwf_Component_Cache_UrlClearCache_Root');
$this->_root = Kwf_Component_Data_Root::getInstance();
Kwf_Benchmark::reset();
$c = $this->_root->getPageByUrl("http://{$d}/foo", null);
//cached
$this->assertEquals('1', $c->componentId);
$this->assertEquals(0, (int) Kwf_Benchmark::getCounterValue('componentDatas'));
$this->assertEquals(1, Kwf_Benchmark::getCounterValue('unserialized componentDatas'));
}
示例13: setUp
public function setUp()
{
Kwf_Component_Data_Root::setComponentClass('Kwc_Basic_TextSessionModel_Root');
parent::setUp();
}
示例14: setUp
public function setUp()
{
parent::setUp();
Kwf_Component_Data_Root::setComponentClass('Kwc_Legacy_Columns_Basic_Root');
}
示例15: setUp
public function setUp()
{
Kwf_Component_Data_Root::setComponentClass(false);
}