Mercurial > hg > isophonics-drupal-site
comparison core/modules/simpletest/src/KernelTestBase.php @ 18:af1871eacc83
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:33:08 +0100 |
parents | 129ea1e6d783 |
children |
comparison
equal
deleted
inserted
replaced
17:129ea1e6d783 | 18:af1871eacc83 |
---|---|
1 <?php | 1 <?php |
2 | 2 |
3 namespace Drupal\simpletest; | 3 namespace Drupal\simpletest; |
4 | |
5 @trigger_error(__NAMESPACE__ . '\KernelTestBase is deprecated in Drupal 8.0.x, will be removed before Drupal 9.0.0. Use \Drupal\KernelTests\KernelTestBase instead.', E_USER_DEPRECATED); | |
4 | 6 |
5 use Drupal\Component\Utility\Html; | 7 use Drupal\Component\Utility\Html; |
6 use Drupal\Component\Render\FormattableMarkup; | 8 use Drupal\Component\Render\FormattableMarkup; |
7 use Drupal\Component\Utility\Variable; | 9 use Drupal\Component\Utility\Variable; |
8 use Drupal\Core\Config\Development\ConfigSchemaChecker; | 10 use Drupal\Core\Config\Development\ConfigSchemaChecker; |
9 use Drupal\Core\Database\Database; | 11 use Drupal\Core\Database\Database; |
10 use Drupal\Core\DependencyInjection\ContainerBuilder; | 12 use Drupal\Core\DependencyInjection\ContainerBuilder; |
11 use Drupal\Core\DrupalKernel; | 13 use Drupal\Core\DrupalKernel; |
12 use Drupal\Core\Entity\Sql\SqlEntityStorageInterface; | 14 use Drupal\Core\Entity\Sql\SqlEntityStorageInterface; |
13 use Drupal\Core\Extension\ExtensionDiscovery; | 15 use Drupal\Core\Extension\ExtensionDiscovery; |
16 use Drupal\Core\File\FileSystemInterface; | |
14 use Drupal\Core\KeyValueStore\KeyValueMemoryFactory; | 17 use Drupal\Core\KeyValueStore\KeyValueMemoryFactory; |
15 use Drupal\Core\Language\Language; | 18 use Drupal\Core\Language\Language; |
16 use Drupal\Core\Site\Settings; | 19 use Drupal\Core\Site\Settings; |
17 use Drupal\KernelTests\TestServiceProvider; | 20 use Drupal\KernelTests\TestServiceProvider; |
18 use Symfony\Component\DependencyInjection\Parameter; | 21 use Symfony\Component\DependencyInjection\Parameter; |
145 include_once DRUPAL_ROOT . '/core/includes/install.inc'; | 148 include_once DRUPAL_ROOT . '/core/includes/install.inc'; |
146 // Assign the relative path to the global variable. | 149 // Assign the relative path to the global variable. |
147 $path = $this->siteDirectory . '/config_' . CONFIG_SYNC_DIRECTORY; | 150 $path = $this->siteDirectory . '/config_' . CONFIG_SYNC_DIRECTORY; |
148 $GLOBALS['config_directories'][CONFIG_SYNC_DIRECTORY] = $path; | 151 $GLOBALS['config_directories'][CONFIG_SYNC_DIRECTORY] = $path; |
149 // Ensure the directory can be created and is writeable. | 152 // Ensure the directory can be created and is writeable. |
150 if (!file_prepare_directory($path, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) { | 153 if (!\Drupal::service('file_system')->prepareDirectory($path, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS)) { |
151 throw new \RuntimeException("Failed to create '" . CONFIG_SYNC_DIRECTORY . "' config directory $path"); | 154 throw new \RuntimeException("Failed to create '" . CONFIG_SYNC_DIRECTORY . "' config directory $path"); |
152 } | 155 } |
153 // Provide the already resolved path for tests. | 156 // Provide the already resolved path for tests. |
154 $this->configDirectories[CONFIG_SYNC_DIRECTORY] = $path; | 157 $this->configDirectories[CONFIG_SYNC_DIRECTORY] = $path; |
155 } | 158 } |
281 $this->enableModules($modules); | 284 $this->enableModules($modules); |
282 } | 285 } |
283 | 286 |
284 // Tests based on this class are entitled to use Drupal's File and | 287 // Tests based on this class are entitled to use Drupal's File and |
285 // StreamWrapper APIs. | 288 // StreamWrapper APIs. |
286 // @todo Move StreamWrapper management into DrupalKernel. | 289 \Drupal::service('file_system')->prepareDirectory($this->publicFilesDirectory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS); |
287 // @see https://www.drupal.org/node/2028109 | |
288 file_prepare_directory($this->publicFilesDirectory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); | |
289 $this->settingsSet('file_public_path', $this->publicFilesDirectory); | 290 $this->settingsSet('file_public_path', $this->publicFilesDirectory); |
290 $this->streamWrappers = []; | 291 $this->streamWrappers = []; |
291 $this->registerStreamWrapper('public', 'Drupal\Core\StreamWrapper\PublicStream'); | 292 $this->registerStreamWrapper('public', 'Drupal\Core\StreamWrapper\PublicStream'); |
292 // The temporary stream wrapper is able to operate both with and without | 293 // The temporary stream wrapper is able to operate both with and without |
293 // configuration. | 294 // configuration. |