Commit 73585ec1 authored by alexpott's avatar alexpott

Issue #2392559 by mondrake, mitrpaka, JeroenT, rpayanm, adci_contributor,...

Issue #2392559 by mondrake, mitrpaka, JeroenT, rpayanm, adci_contributor, ianthomas_uk: Remove all uses of file_stream_wrapper_get_* and file_get_stream_wrappers
parent 23df3d55
......@@ -1384,6 +1384,7 @@ services:
alias: plugin.manager.element_info
file.mime_type.guesser:
class: Drupal\Core\File\MimeType\MimeTypeGuesser
arguments: ['@stream_wrapper_manager']
tags:
- { name: service_collector, tag: mime_type_guesser, call: addGuesser }
lazy: true
......
......@@ -229,7 +229,7 @@ function file_stream_wrapper_uri_normalize($uri) {
* "private://example.txt" would return a new private stream wrapper object
* (Drupal\Core\StreamWrapper\PrivateStream).
*
* * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
* @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
* Use \Drupal::service('stream_wrapper_manager')->getViaUri().
*/
function file_stream_wrapper_get_instance_by_uri($uri) {
......@@ -331,7 +331,7 @@ function file_create_url($uri) {
}
else {
// Attempt to return an external URL using the appropriate wrapper.
if ($wrapper = file_stream_wrapper_get_instance_by_uri($uri)) {
if ($wrapper = \Drupal::service('stream_wrapper_manager')->getViaUri($uri)) {
return $wrapper->getExternalUrl();
}
else {
......
......@@ -253,12 +253,11 @@ public function install(array $module_list, $enable_dependencies = TRUE) {
// Record the fact that it was installed.
$modules_installed[] = $module;
// file_get_stream_wrappers() needs to re-register Drupal's stream
// wrappers in case a module-provided stream wrapper is used later in
// the same request. In particular, this happens when installing Drupal
// via Drush, as the 'translations' stream wrapper is provided by
// Interface Translation module and is later used to import
// translations.
// Drupal's stream wrappers needs to be re-registered in case a
// module-provided stream wrapper is used later in the same request. In
// particular, this happens when installing Drupal via Drush, as the
// 'translations' stream wrapper is provided by Interface Translation
// module and is later used to import translations.
\Drupal::service('stream_wrapper_manager')->register();
// Update the theme registry to include it.
......
......@@ -7,6 +7,7 @@
namespace Drupal\Core\File\MimeType;
use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser as SymfonyMimeTypeGuesser;
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface;
......@@ -35,11 +36,28 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface {
*/
protected $sortedGuessers = NULL;
/**
* The stream wrapper manager.
*
* @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface
*/
protected $streamWrapperManager;
/**
* Constructs a MimeTypeGuesser object.
*
* @param StreamWrapperManagerInterface $streamWrapperManager
* The stream wrapper manager.
*/
public function __construct(StreamWrapperManagerInterface $stream_wrapper_manager) {
$this->streamWrapperManager = $stream_wrapper_manager;
}
/**
* {@inheritdoc}
*/
public function guess($path) {
if ($wrapper = file_stream_wrapper_get_instance_by_uri($path)) {
if ($wrapper = $this->streamWrapperManager->getViaUri($path)) {
// Get the real path from the stream wrapper.
$path = $wrapper->realpath();
}
......
......@@ -80,7 +80,7 @@ function hook_file_url_alter(&$uri) {
}
// Public created files.
else {
$wrapper = file_stream_wrapper_get_instance_by_scheme($scheme);
$wrapper = \Drupal::service('stream_wrapper_manager')->getViaScheme($scheme);
$path = $wrapper->getDirectoryPath() . '/' . file_uri_target($uri);
}
......
......@@ -12,7 +12,6 @@
/**
* Provides a StreamWrapper manager.
*
* @see file_get_stream_wrappers()
* @see \Drupal\Core\StreamWrapper\StreamWrapperInterface
*/
class StreamWrapperManager extends ContainerAware implements StreamWrapperManagerInterface {
......
......@@ -10,7 +10,6 @@
/**
* Provides a StreamWrapper manager.
*
* @see file_get_stream_wrappers()
* @see \Drupal\Core\StreamWrapper\StreamWrapperInterface
*/
interface StreamWrapperManagerInterface {
......@@ -39,8 +38,8 @@ interface StreamWrapperManagerInterface {
* returns only stream wrappers that use local file storage:
*
* @code
* $local_stream_wrappers =
* file_get_stream_wrappers(StreamWrapperInterface::LOCAL);
* $stream_wrapper_manager = \Drupal::service('stream_wrapper_manager');
* $local_stream_wrappers = $stream_wrapper_manager->getWrappers(StreamWrapperInterface::LOCAL);
* @endcode
*
* The $filter parameter can only filter to types containing a particular
......@@ -50,9 +49,11 @@ interface StreamWrapperManagerInterface {
* array_diff_key() function can be used to help with this. For example, this
* returns only stream wrappers that do not use local file storage:
* @code
* $remote_stream_wrappers =
* array_diff_key(file_get_stream_wrappers(StreamWrapperInterface::ALL),
* file_get_stream_wrappers(StreamWrapperInterface::LOCAL));
* $stream_wrapper_manager = \Drupal::service('stream_wrapper_manager');
* $remote_stream_wrappers = array_diff_key(
* $stream_wrapper_manager->getWrappers(StreamWrapperInterface::ALL),
* $stream_wrapper_manager->getWrappers(StreamWrapperInterface::LOCAL)
* );
* @endcode
*
* @param int $filter
......
......@@ -365,7 +365,7 @@ public function makeBackup(FileTransfer $filetransfer, $from, $to) {
* Returns the full path to a directory where backups should be written.
*/
public function getBackupDir() {
return file_stream_wrapper_get_instance_by_scheme('temporary')->getDirectoryPath();
return \Drupal::service('stream_wrapper_manager')->getViaScheme('temporary')->getDirectoryPath();
}
/**
......
......@@ -30,7 +30,7 @@ function testPublicFileTransfer() {
$url = file_create_url($file->getFileUri());
// URLs can't contain characters outside the ASCII set so $filename has to be
// encoded.
$filename = $GLOBALS['base_url'] . '/' . file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath() . '/' . rawurlencode($file->getFilename());
$filename = $GLOBALS['base_url'] . '/' . \Drupal::service('stream_wrapper_manager')->getViaScheme('public')->getDirectoryPath() . '/' . rawurlencode($file->getFilename());
$this->assertEqual($filename, $url, 'Correctly generated a URL for a created file.');
$this->drupalHead($url);
$this->assertResponse(200, 'Confirmed that the generated URL is correct by downloading the created file.');
......@@ -117,7 +117,7 @@ function testFileCreateUrl() {
$clean_urls = $clean_url_setting == 'clean';
$request = $this->prepareRequestForGenerator($clean_urls);
$base_path = $request->getSchemeAndHttpHost() . $request->getBasePath();
$this->checkUrl('public', '', $basename, $base_path . '/' . file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath() . '/' . $basename_encoded);
$this->checkUrl('public', '', $basename, $base_path . '/' . \Drupal::service('stream_wrapper_manager')->getViaScheme('public')->getDirectoryPath() . '/' . $basename_encoded);
$this->checkUrl('private', '', $basename, $base_path . '/' . $script_path . 'system/files/' . $basename_encoded);
}
$this->assertEqual(file_create_url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='), 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==', t('Generated URL matches expected URL.'));
......
......@@ -222,7 +222,7 @@ function file_test_file_url_alter(&$uri) {
}
// Public created files.
else {
$wrapper = file_stream_wrapper_get_instance_by_scheme($scheme);
$wrapper = \Drupal::service('stream_wrapper_manager')->getViaScheme($scheme);
$path = $wrapper->getDirectoryPath() . '/' . file_uri_target($uri);
}
......@@ -252,7 +252,7 @@ function file_test_file_url_alter(&$uri) {
}
// Public created files.
else {
$wrapper = file_stream_wrapper_get_instance_by_scheme($scheme);
$wrapper = \Drupal::service('stream_wrapper_manager')->getViaScheme($scheme);
$path = $wrapper->getDirectoryPath() . '/' . file_uri_target($uri);
}
......@@ -275,7 +275,7 @@ function file_test_file_url_alter(&$uri) {
}
// Public created files.
else {
$wrapper = file_stream_wrapper_get_instance_by_scheme($scheme);
$wrapper = \Drupal::service('stream_wrapper_manager')->getViaScheme($scheme);
$path = $wrapper->getDirectoryPath() . '/' . file_uri_target($uri);
}
......
services:
path_processor.image_styles:
class: Drupal\image\PathProcessor\PathProcessorImageStyles
arguments: ['@stream_wrapper_manager']
tags:
- { name: path_processor_inbound, priority: 300 }
plugin.manager.image.effect:
......
......@@ -226,7 +226,7 @@ public function buildUrl($path, $clean_urls = NULL) {
// to the actual file path, this avoids bootstrapping PHP once the files are
// built.
if ($clean_urls === FALSE && file_uri_scheme($uri) == 'public' && !file_exists($uri)) {
$directory_path = file_stream_wrapper_get_instance_by_uri($uri)->getDirectoryPath();
$directory_path = \Drupal::service('stream_wrapper_manager')->getViaUri($uri)->getDirectoryPath();
return Url::fromUri('base:' . $directory_path . '/' . file_uri_target($uri), array('absolute' => TRUE, 'query' => $token_query))->toString();
}
......
......@@ -8,6 +8,7 @@
namespace Drupal\image\PathProcessor;
use Drupal\Core\PathProcessor\InboundPathProcessorInterface;
use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface;
use Symfony\Component\HttpFoundation\Request;
/**
......@@ -27,11 +28,28 @@
*/
class PathProcessorImageStyles implements InboundPathProcessorInterface {
/**
* The stream wrapper manager service.
*
* @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface
*/
protected $streamWrapperManager;
/**
* Constructs a new PathProcessorImageStyles object.
*
* @param \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager
* The stream wrapper manager service.
*/
public function __construct(StreamWrapperManagerInterface $stream_wrapper_manager) {
$this->streamWrapperManager = $stream_wrapper_manager;
}
/**
* {@inheritdoc}
*/
public function processInbound($path, Request $request) {
$directory_path = file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath();
$directory_path = $this->streamWrapperManager->getViaScheme('public')->getDirectoryPath();
if (strpos($path, '/' . $directory_path . '/styles/') === 0) {
$path_prefix = '/' . $directory_path . '/styles/';
}
......
......@@ -7,12 +7,41 @@
namespace Drupal\image\Routing;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Route;
/**
* Defines a route subscriber to register a url for serving image styles.
*/
class ImageStyleRoutes {
class ImageStyleRoutes implements ContainerInjectionInterface {
/**
* The stream wrapper manager service.
*
* @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface
*/
protected $streamWrapperManager;
/**
* Constructs a new PathProcessorImageStyles object.
*
* @param \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager
* The stream wrapper manager service.
*/
public function __construct(StreamWrapperManagerInterface $stream_wrapper_manager) {
$this->streamWrapperManager = $stream_wrapper_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('stream_wrapper_manager')
);
}
/**
* Returns an array of route objects.
......@@ -26,7 +55,7 @@ public function routes() {
// disabled image derivatives will always be served through the menu system.
// If clean URLs are enabled and the image derivative already exists, PHP
// will be bypassed.
$directory_path = file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath();
$directory_path = $this->streamWrapperManager->getViaScheme('public')->getDirectoryPath();
$routes['image.style_public'] = new Route(
'/' . $directory_path . '/styles/{image_style}/{scheme}',
......
......@@ -950,7 +950,7 @@ public function installDrupal() {
// Reset/rebuild all data structures after enabling the modules, primarily
// to synchronize all data structures and caches between the test runner and
// the child site.
// Affects e.g. file_get_stream_wrappers().
// Affects e.g. StreamWrapperManagerInterface::getWrappers().
// @see \Drupal\Core\DrupalKernel::bootCode()
// @todo Test-specific setUp() methods may set up further fixtures; find a
// way to execute this after setUp() is done, or to eliminate it entirely.
......
......@@ -9,8 +9,12 @@
use Drupal\Component\Utility\Color;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\ImageToolkit\ImageToolkitBase;
use Drupal\Core\ImageToolkit\ImageToolkitOperationManagerInterface;
use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\StreamWrapper\StreamWrapperInterface;
......@@ -53,6 +57,36 @@ class GDToolkit extends ImageToolkitBase {
*/
protected $preLoadInfo = NULL;
/**
* The StreamWrapper manager.
*
* @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface
*/
protected $streamWrapperManager;
/**
* Constructs a TestToolkit object.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin_id for the plugin instance.
* @param array $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\ImageToolkit\ImageToolkitOperationManagerInterface $operation_manager
* The toolkit operation manager.
* @param \Psr\Log\LoggerInterface $logger
* A logger instance.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
* @param \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager
* The StreamWrapper manager.
*/
public function __construct(array $configuration, $plugin_id, array $plugin_definition, ImageToolkitOperationManagerInterface $operation_manager, LoggerInterface $logger, ConfigFactoryInterface $config_factory, StreamWrapperManagerInterface $stream_wrapper_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $operation_manager, $logger, $config_factory);
$this->streamWrapperManager = $stream_wrapper_manager;
}
/**
* {@inheritdoc}
*/
......@@ -63,7 +97,8 @@ public static function create(ContainerInterface $container, array $configuratio
$plugin_definition,
$container->get('image.toolkit.operation.manager'),
$container->get('logger.channel.image'),
$container->get('config.factory')
$container->get('config.factory'),
$container->get('stream_wrapper_manager')
);
}
......@@ -172,7 +207,7 @@ public function save($destination) {
// Work around lack of stream wrapper support in imagejpeg() and imagepng().
if ($scheme && file_stream_wrapper_valid_scheme($scheme)) {
// If destination is not local, save image to temporary local file.
$local_wrappers = file_get_stream_wrappers(StreamWrapperInterface::LOCAL);
$local_wrappers = $this->streamWrapperManager->getWrappers(StreamWrapperInterface::LOCAL);
if (!isset($local_wrappers[$scheme])) {
$permanent_destination = $destination;
$destination = drupal_tempnam('temporary://', 'gd_');
......
......@@ -297,14 +297,14 @@ function testModuleMetaData() {
public function testModuleStreamWrappers() {
// file_test.module provides (among others) a 'dummy' stream wrapper.
// Verify that it is not registered yet to prevent false positives.
$stream_wrappers = file_get_stream_wrappers();
$stream_wrappers = \Drupal::service('stream_wrapper_manager')->getWrappers();
$this->assertFalse(isset($stream_wrappers['dummy']));
$this->moduleInstaller()->install(['file_test']);
// Verify that the stream wrapper is available even without calling
// file_get_stream_wrappers() again. If the stream wrapper is not available
// file_exists() will raise a notice.
// \Drupal::service('stream_wrapper_manager')->getWrappers() again.
// If the stream wrapper is not available file_exists() will raise a notice.
file_exists('dummy://');
$stream_wrappers = file_get_stream_wrappers();
$stream_wrappers = \Drupal::service('stream_wrapper_manager')->getWrappers();
$this->assertTrue(isset($stream_wrappers['dummy']));
}
......
......@@ -40,7 +40,7 @@ function testReadOnlyBehavior() {
// Generate a read-only stream wrapper instance
$uri = $this->scheme . '://' . $filename;
file_stream_wrapper_get_instance_by_scheme($this->scheme);
\Drupal::service('stream_wrapper_manager')->getViaScheme($this->scheme);
// Attempt to open a file in read/write mode
$handle = @fopen($uri, 'r+');
......
......@@ -56,32 +56,32 @@ function setUp() {
*/
function testGetClassName() {
// Check the dummy scheme.
$this->assertEqual($this->classname, file_stream_wrapper_get_class($this->scheme), 'Got correct class name for dummy scheme.');
$this->assertEqual($this->classname, \Drupal::service('stream_wrapper_manager')->getClass($this->scheme), 'Got correct class name for dummy scheme.');
// Check core's scheme.
$this->assertEqual('Drupal\Core\StreamWrapper\PublicStream', file_stream_wrapper_get_class('public'), 'Got correct class name for public scheme.');
$this->assertEqual('Drupal\Core\StreamWrapper\PublicStream', \Drupal::service('stream_wrapper_manager')->getClass('public'), 'Got correct class name for public scheme.');
}
/**
* Test the file_stream_wrapper_get_instance_by_scheme() function.
* Test the getViaScheme() method.
*/
function testGetInstanceByScheme() {
$instance = file_stream_wrapper_get_instance_by_scheme($this->scheme);
$instance = \Drupal::service('stream_wrapper_manager')->getViaScheme($this->scheme);
$this->assertEqual($this->classname, get_class($instance), 'Got correct class type for dummy scheme.');
$instance = file_stream_wrapper_get_instance_by_scheme('public');
$instance = \Drupal::service('stream_wrapper_manager')->getViaScheme('public');
$this->assertEqual('Drupal\Core\StreamWrapper\PublicStream', get_class($instance), 'Got correct class type for public scheme.');
}
/**
* Test the URI and target functions.
* Test the getViaUri() and getViaScheme() methods and target functions.
*/
function testUriFunctions() {
$config = $this->config('system.file');
$instance = file_stream_wrapper_get_instance_by_uri($this->scheme . '://foo');
$instance = \Drupal::service('stream_wrapper_manager')->getViaUri($this->scheme . '://foo');
$this->assertEqual($this->classname, get_class($instance), 'Got correct class type for dummy URI.');
$instance = file_stream_wrapper_get_instance_by_uri('public://foo');
$instance = \Drupal::service('stream_wrapper_manager')->getViaUri('public://foo');
$this->assertEqual('Drupal\Core\StreamWrapper\PublicStream', get_class($instance), 'Got correct class type for public URI.');
// Test file_uri_target().
......@@ -94,8 +94,8 @@ function testUriFunctions() {
// Test file_build_uri() and
// Drupal\Core\StreamWrapper\LocalStream::getDirectoryPath().
$this->assertEqual(file_build_uri('foo/bar.txt'), 'public://foo/bar.txt', 'Expected scheme was added.');
$this->assertEqual(file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath(), PublicStream::basePath(), 'Expected default directory path was returned.');
$this->assertEqual(file_stream_wrapper_get_instance_by_scheme('temporary')->getDirectoryPath(), $config->get('path.temporary'), 'Expected temporary directory path was returned.');
$this->assertEqual(\Drupal::service('stream_wrapper_manager')->getViaScheme('public')->getDirectoryPath(), PublicStream::basePath(), 'Expected default directory path was returned.');
$this->assertEqual(\Drupal::service('stream_wrapper_manager')->getViaScheme('temporary')->getDirectoryPath(), $config->get('path.temporary'), 'Expected temporary directory path was returned.');
$config->set('default_scheme', 'private')->save();
$this->assertEqual(file_build_uri('foo/bar.txt'), 'private://foo/bar.txt', 'Got a valid URI from foo/bar.txt.');
......
......@@ -80,7 +80,7 @@ function testPublicManagedFileURL() {
\Drupal::state()->set('file_test.hook_file_url_alter', 'cdn');
$uri = $this->createUri();
$url = file_create_url($uri);
$public_directory_path = file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath();
$public_directory_path = \Drupal::service('stream_wrapper_manager')->getViaScheme('public')->getDirectoryPath();
$this->assertEqual(FILE_URL_TEST_CDN_2 . '/' . $public_directory_path . '/' . drupal_basename($uri), $url, 'Correctly generated a CDN URL for a created file.');
// Test alteration of file URLs to use root-relative URLs.
......@@ -116,7 +116,7 @@ function testRelativeFileURL() {
// Managed file.
$uri = $this->createUri();
$url = file_create_url($uri);
$public_directory_path = file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath();
$public_directory_path = \Drupal::service('stream_wrapper_manager')->getViaScheme('public')->getDirectoryPath();
$this->assertIdentical(base_path() . $public_directory_path . '/' . rawurlencode(drupal_basename($uri)), file_url_transform_relative($url));
}
......
......@@ -290,7 +290,7 @@ function sessionReset($uid = 0) {
$this->loggedInUser = FALSE;
// Change cookie file for user.
$this->cookieFile = file_stream_wrapper_get_instance_by_scheme('temporary')->getDirectoryPath() . '/cookie.' . $uid . '.txt';
$this->cookieFile = \Drupal::service('stream_wrapper_manager')->getViaScheme('temporary')->getDirectoryPath() . '/cookie.' . $uid . '.txt';
$this->additionalCurlOptions[CURLOPT_COOKIEFILE] = $this->cookieFile;
$this->additionalCurlOptions[CURLOPT_COOKIESESSION] = TRUE;
$this->drupalGet('session-test/get');
......
......@@ -9,6 +9,7 @@
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\File\MimeType\MimeTypeGuesser;
use Drupal\Core\StreamWrapper\StreamWrapperManager;
use Drupal\Tests\UnitTestCase;
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser as SymfonyMimeTypeGuesser;
......@@ -34,14 +35,14 @@ public function testSymfonyGuesserRegistration() {
$this->assertNotInstanceOf('Drupal\Core\File\MimeType\MimeTypeGuesser', $guessers[0]);
}
$container = new ContainerBuilder();
$container->set('file.mime_type.guesser', new MimeTypeGuesser());
$container->set('file.mime_type.guesser', new MimeTypeGuesser(new StreamWrapperManager()));
MimeTypeGuesser::registerWithSymfonyGuesser($container);
$guessers = $this->readAttribute($symfony_guesser, 'guessers');
$this->assertInstanceOf('Drupal\Core\File\MimeType\MimeTypeGuesser', $guessers[0]);
$count = count($guessers);
$container = new ContainerBuilder();
$container->set('file.mime_type.guesser', new MimeTypeGuesser());
$container->set('file.mime_type.guesser', new MimeTypeGuesser(new StreamWrapperManager()));
MimeTypeGuesser::registerWithSymfonyGuesser($container);
$guessers = $this->readAttribute($symfony_guesser, 'guessers');
$this->assertInstanceOf('Drupal\Core\File\MimeType\MimeTypeGuesser', $guessers[0]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment