当前位置: 首页>>代码示例>>PHP>>正文


PHP FileCacheFactory::setPrefix方法代码示例

本文整理汇总了PHP中Drupal\Component\FileCache\FileCacheFactory::setPrefix方法的典型用法代码示例。如果您正苦于以下问题:PHP FileCacheFactory::setPrefix方法的具体用法?PHP FileCacheFactory::setPrefix怎么用?PHP FileCacheFactory::setPrefix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\Component\FileCache\FileCacheFactory的用法示例。


在下文中一共展示了FileCacheFactory::setPrefix方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     FileCacheFactory::setPrefix($this->randomString(4));
     parent::setUp();
     $this->controller = $this->container->get('entity.manager')->getStorage('entity_browser');
     $this->widgetUUID = $this->container->get('uuid')->generate();
     $this->routeProvider = $this->container->get('router.route_provider');
 }
开发者ID:nB-MDSO,项目名称:mdso-d8blog,代码行数:11,代码来源:EntityBrowserTest.php

示例2: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Ensure that an instantiated container in the global state of \Drupal from
     // a previous test does not leak into this test.
     \Drupal::unsetContainer();
     // Ensure that the NullFileCache implementation is used for the FileCache as
     // unit tests should not be relying on caches implicitly.
     FileCacheFactory::setConfiguration([FileCacheFactory::DISABLE_CACHE => TRUE]);
     // Ensure that FileCacheFactory has a prefix.
     FileCacheFactory::setPrefix('prefix');
     $this->root = dirname(dirname(substr(__DIR__, 0, -strlen(__NAMESPACE__))));
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:16,代码来源:UnitTestCase.php

示例3: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     // @todo Extra hack to avoid test fails, remove this once
     // https://www.drupal.org/node/2553661 is fixed.
     FileCacheFactory::setPrefix(Settings::getApcuPrefix('file_cache', $this->root));
     parent::setUp();
     $this->logger = $this->container->get('logger.channel.rules');
     // Clear the log from any stale entries that are bleeding over from previous
     // tests.
     $this->logger->clearLogs();
     $this->expressionManager = $this->container->get('plugin.manager.rules_expression');
     $this->conditionManager = $this->container->get('plugin.manager.condition');
     $this->typedDataManager = $this->container->get('typed_data_manager');
 }
开发者ID:shahinam,项目名称:drupal8devel,代码行数:17,代码来源:RulesDrupalTestBase.php

示例4: setUp

 public function setUp()
 {
     FileCacheFactory::setPrefix($this->randomMachineName());
     $plugin_type_id_a = $this->randomMachineName();
     $this->pluginTypeDefinitions[$plugin_type_id_a] = ['label' => $this->randomMachineName(), 'description' => $this->randomMachineName(), 'provider' => $this->randomMachineName(), 'plugin_manager_service_id' => $this->randomMachineName()];
     $plugin_type_id_b = $this->randomMachineName();
     $this->pluginTypeDefinitions[$plugin_type_id_b] = ['label' => $this->randomMachineName(), 'description' => $this->randomMachineName(), 'provider' => $this->randomMachineName(), 'plugin_manager_service_id' => $this->randomMachineName()];
     $this->pluginManagers = [$plugin_type_id_a => $this->getMock(PluginManagerInterface::class), $plugin_type_id_b => $this->getMock(PluginManagerInterface::class)];
     vfsStreamWrapper::register();
     $root = new vfsStreamDirectory('modules');
     vfsStreamWrapper::setRoot($root);
     $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
     $this->moduleHandler->expects($this->any())->method('getModuleDirectories')->willReturn(array('module_a' => vfsStream::url('modules/module_a'), 'module_b' => vfsStream::url('modules/module_b')));
     $class_resolver = $this->getMock(ClassResolverInterface::class);
     $this->container = $this->getMock(ContainerInterface::class);
     $map = [['class_resolver', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $class_resolver], ['string_translation', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->getStringTranslationStub()], [$this->pluginTypeDefinitions[$plugin_type_id_a]['plugin_manager_service_id'], ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->pluginManagers[$plugin_type_id_a]], [$this->pluginTypeDefinitions[$plugin_type_id_b]['plugin_manager_service_id'], ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $this->pluginManagers[$plugin_type_id_b]]];
     $this->container->expects($this->any())->method('get')->willReturnMap($map);
     $url = vfsStream::url('modules');
     mkdir($url . '/module_a');
     file_put_contents($url . '/module_a/module_a.plugin_type.yml', $this->buildPluginDefinitionYaml($plugin_type_id_a, $this->pluginTypeDefinitions[$plugin_type_id_a]['label'], $this->pluginTypeDefinitions[$plugin_type_id_a]['description'], $this->pluginTypeDefinitions[$plugin_type_id_a]['provider'], $this->pluginTypeDefinitions[$plugin_type_id_a]['plugin_manager_service_id']));
     mkdir($url . '/module_b');
     file_put_contents($url . '/module_b/module_b.plugin_type.yml', $this->buildPluginDefinitionYaml($plugin_type_id_b, $this->pluginTypeDefinitions[$plugin_type_id_b]['label'], $this->pluginTypeDefinitions[$plugin_type_id_b]['description'], $this->pluginTypeDefinitions[$plugin_type_id_b]['provider'], $this->pluginTypeDefinitions[$plugin_type_id_b]['plugin_manager_service_id']));
     $this->sut = new PluginTypeManager($this->container, $this->moduleHandler);
 }
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:24,代码来源:PluginTypeManagerTest.php

示例5: boot

 /**
  * {@inheritdoc}
  */
 public function boot()
 {
     if ($this->booted) {
         return $this;
     }
     // Ensure that findSitePath is set.
     if (!$this->sitePath) {
         throw new \Exception('Kernel does not have site path set before calling boot()');
     }
     // Initialize the FileCacheFactory component. We have to do it here instead
     // of in \Drupal\Component\FileCache\FileCacheFactory because we can not use
     // the Settings object in a component.
     $configuration = Settings::get('file_cache');
     // Provide a default configuration, if not set.
     if (!isset($configuration['default'])) {
         $configuration['default'] = ['class' => '\\Drupal\\Component\\FileCache\\FileCache', 'cache_backend_class' => NULL, 'cache_backend_configuration' => []];
         // @todo Use extension_loaded('apcu') for non-testbot
         //  https://www.drupal.org/node/2447753.
         if (function_exists('apcu_fetch')) {
             $configuration['default']['cache_backend_class'] = '\\Drupal\\Component\\FileCache\\ApcuFileCacheBackend';
         }
     }
     FileCacheFactory::setConfiguration($configuration);
     FileCacheFactory::setPrefix(Settings::getApcuPrefix('file_cache', $this->root));
     $this->bootstrapContainer = new $this->bootstrapContainerClass(Settings::get('bootstrap_container_definition', $this->defaultBootstrapContainerDefinition));
     // Initialize the container.
     $this->initializeContainer();
     $this->booted = TRUE;
     return $this;
 }
开发者ID:sgtsaughter,项目名称:d8portfolio,代码行数:33,代码来源:DrupalKernel.php

示例6: initFileCache

 /**
  * Initializes the FileCache component.
  *
  * We can not use the Settings object in a component, that's why we have to do
  * it here instead of \Drupal\Component\FileCache\FileCacheFactory.
  */
 protected function initFileCache()
 {
     $configuration = Settings::get('file_cache');
     // Provide a default configuration, if not set.
     if (!isset($configuration['default'])) {
         $configuration['default'] = ['class' => FileCache::class, 'cache_backend_class' => NULL, 'cache_backend_configuration' => []];
         // @todo Use extension_loaded('apcu') for non-testbot
         //  https://www.drupal.org/node/2447753.
         if (function_exists('apcu_fetch')) {
             $configuration['default']['cache_backend_class'] = ApcuFileCacheBackend::class;
         }
     }
     FileCacheFactory::setConfiguration($configuration);
     FileCacheFactory::setPrefix(Settings::getApcuPrefix('file_cache', $this->root));
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:21,代码来源:KernelTestBase.php

示例7: __construct

 /**
  * Creates the discovery object.
  *
  * @param string|bool $subdir
  *   The plugin's subdirectory, for example Plugin/views/filter.
  * @param \Traversable $namespaces
  *   An object that implements \Traversable which contains the root paths
  *   keyed by the corresponding namespace to look for plugin implementations.
  * @param string|null $plugin_interface
  *   (optional) The interface each plugin should implement.
  * @param string $plugin_definition_annotation_name
  *   (optional) The name of the annotation that contains the plugin definition.
  *   Defaults to 'Drupal\Component\Annotation\Plugin'.
  */
 public function __construct($subdir, \Traversable $namespaces, $plugin_interface = NULL, $plugin_definition_annotation_name = 'Drupal\\Component\\Annotation\\Plugin')
 {
     $this->subdir = $subdir;
     $this->namespaces = $namespaces;
     $this->pluginDefinitionAnnotationName = $plugin_definition_annotation_name;
     $this->pluginInterface = $plugin_interface;
     // Add the file cache prefix.
     $configuration['default'] = ['class' => '\\Drupal\\Component\\FileCache\\FileCache', 'cache_backend_class' => NULL, 'cache_backend_configuration' => []];
     // @todo Use extension_loaded('apcu') for non-testbot
     //  https://www.drupal.org/node/2447753.
     if (function_exists('apc_fetch')) {
         $configuration['default']['cache_backend_class'] = '\\Drupal\\Component\\FileCache\\ApcuFileCacheBackend';
     }
     FileCacheFactory::setConfiguration($configuration);
     $identifier = 'file_cache';
     FileCacheFactory::setPrefix('drupal.' . $identifier . '.' . hash_hmac('sha256', $identifier, drupal_get_hash_salt()));
 }
开发者ID:jhoffman-tm,项目名称:waldorf-deployment,代码行数:31,代码来源:DefaultPluginManager.php

示例8: testGetSetPrefix

 /**
  * @covers ::getPrefix
  * @covers ::setPrefix
  */
 public function testGetSetPrefix()
 {
     $prefix = $this->randomMachineName();
     FileCacheFactory::setPrefix($prefix);
     $this->assertEquals($prefix, FileCacheFactory::getPrefix());
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:10,代码来源:FileCacheFactoryTest.php

示例9: boot

 /**
  * {@inheritdoc}
  */
 public function boot()
 {
     if ($this->booted) {
         return $this;
     }
     // Ensure that findSitePath is set.
     if (!$this->sitePath) {
         throw new \Exception('Kernel does not have site path set before calling boot()');
     }
     // Initialize the FileCacheFactory component. We have to do it here instead
     // of in \Drupal\Component\FileCache\FileCacheFactory because we can not use
     // the Settings object in a component.
     $configuration = Settings::get('file_cache');
     // Provide a default configuration, if not set.
     if (!isset($configuration['default'])) {
         $configuration['default'] = ['class' => '\\Drupal\\Component\\FileCache\\FileCache', 'cache_backend_class' => NULL, 'cache_backend_configuration' => []];
         // @todo Use extension_loaded('apcu') for non-testbot
         //  https://www.drupal.org/node/2447753.
         if (function_exists('apc_fetch')) {
             $configuration['default']['cache_backend_class'] = '\\Drupal\\Component\\FileCache\\ApcuFileCacheBackend';
         }
     }
     FileCacheFactory::setConfiguration($configuration);
     FileCacheFactory::setPrefix(Settings::getApcuPrefix('file_cache', $this->root));
     // Initialize the container.
     $this->initializeContainer();
     // Ensure mt_rand() is reseeded to prevent random values from one page load
     // being exploited to predict random values in subsequent page loads.
     $seed = unpack("L", Crypt::randomBytes(4));
     mt_srand($seed[1]);
     $this->booted = TRUE;
     return $this;
 }
开发者ID:jeyram,项目名称:camp-gdl,代码行数:36,代码来源:DrupalKernel.php

示例10: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     FileCacheFactory::setPrefix('example');
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:8,代码来源:YamlFileLoaderTest.php


注:本文中的Drupal\Component\FileCache\FileCacheFactory::setPrefix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。