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


PHP DrupalKernel::shutdown方法代码示例

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


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

示例1: tearDown

 /**
  * Cleans up after testing.
  *
  * Deletes created files and temporary files directory, deletes the tables
  * created by setUp(), and resets the database prefix.
  */
 protected function tearDown()
 {
     // Destroy the testing kernel.
     if (isset($this->kernel)) {
         $this->kernel->shutdown();
     }
     parent::tearDown();
     // Ensure that the maximum meta refresh count is reset.
     $this->maximumMetaRefreshCount = NULL;
     // Ensure that internal logged in variable and cURL options are reset.
     $this->loggedInUser = FALSE;
     $this->additionalCurlOptions = array();
     // Close the CURL handler and reset the cookies array used for upgrade
     // testing so test classes containing multiple tests are not polluted.
     $this->curlClose();
     $this->curlCookies = array();
     $this->cookies = array();
 }
开发者ID:Wylbur,项目名称:gj,代码行数:24,代码来源:WebTestBase.php

示例2: getCompiledContainerBuilder

 /**
  * Prepares a precompiled ContainerBuilder for all tests of this class.
  *
  * Avoids repetitive calls to ContainerBuilder::compile(), which is very slow.
  *
  * Based on the (always identical) list of $modules to enable, an initial
  * container is compiled, all instantiated services are reset/removed, and
  * this precompiled container is stored in a static class property. (Static,
  * because PHPUnit instantiates a new class instance for each test *method*.)
  *
  * This method is not invoked if there is only a single test method. It is
  * also not invoked for tests running in process isolation (since each test
  * method runs in a separate process).
  *
  * The ContainerBuilder is not dumped into the filesystem (which would yield
  * an actually compiled Container class), because
  *
  * 1. PHP code cannot be unloaded, so e.g. 900 tests would load 900 different,
  *    full Container classes into memory, quickly exceeding any sensible
  *    memory consumption (GigaBytes).
  * 2. Dumping a Container class requires to actually write to the system's
  *    temporary directory. This is not really easy with vfs, because vfs
  *    doesn't support yet "include 'vfs://container.php'.". Maybe we could fix
  *    that upstream.
  * 3. PhpDumper is very slow on its own.
  *
  * @param string[] $modules
  *   The list of modules to enable.
  *
  * @return \Drupal\Core\DependencyInjection\ContainerBuilder
  *   A clone of the precompiled, empty service container.
  */
 private function getCompiledContainerBuilder(array $modules)
 {
     if (!isset(self::$initialContainerBuilder)) {
         $kernel = new DrupalKernel('testing', $this->classLoader, FALSE);
         $kernel->setSitePath($this->siteDirectory);
         if ($modules && ($extensions = $this->getExtensionsForModules($modules))) {
             $kernel->updateModules($extensions, $extensions);
         }
         $kernel->boot();
         self::$initialContainerBuilder = $kernel->getContainer();
         // Remove all instantiated services, so the container is safe for cloning.
         // Technically, ContainerBuilder::set($id, NULL) removes each definition,
         // but the container is compiled/frozen already.
         foreach (self::$initialContainerBuilder->getServiceIds() as $id) {
             self::$initialContainerBuilder->set($id, NULL);
         }
         // Destruct and trigger garbage collection.
         \Drupal::unsetContainer();
         $kernel->shutdown();
         $kernel = NULL;
         // @see register()
         $this->container = NULL;
     }
     $container = clone self::$initialContainerBuilder;
     return $container;
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:58,代码来源:KernelTestBase.php

示例3: tearDown

 /**
  * {@inheritdoc}
  */
 protected function tearDown()
 {
     parent::tearDown();
     // Destroy the testing kernel.
     if (isset($this->kernel)) {
         $this->cleanupEnvironment();
         $this->kernel->shutdown();
     }
     // Ensure that internal logged in variable is reset.
     $this->loggedInUser = FALSE;
     if ($this->mink) {
         $this->mink->stopSessions();
     }
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:17,代码来源:BrowserTestBase.php

示例4: tearDown

 /**
  * {@inheritdoc}
  */
 protected function tearDown()
 {
     parent::tearDown();
     // Destroy the testing kernel.
     if (isset($this->kernel)) {
         $this->cleanupEnvironment();
         $this->kernel->shutdown();
     }
     // Ensure that internal logged in variable is reset.
     $this->loggedInUser = FALSE;
     if ($this->mink) {
         $this->mink->stopSessions();
     }
     // Restore original shutdown callbacks.
     if (function_exists('drupal_register_shutdown_function')) {
         $callbacks =& drupal_register_shutdown_function();
         $callbacks = $this->originalShutdownCallbacks;
     }
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:22,代码来源:BrowserTestBase.php


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