Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
af1abd85
Commit
af1abd85
authored
Aug 15, 2016
by
alexpott
Browse files
Issue
#2780905
by catch, joelpittet: cache MemoryBackend has a pointless constructor
parent
dd3ee4c7
Changes
15
Hide whitespace changes
Inline
Side-by-side
core/lib/Drupal/Core/Cache/MemoryBackend.php
View file @
af1abd85
...
...
@@ -19,15 +19,6 @@ class MemoryBackend implements CacheBackendInterface, CacheTagsInvalidatorInterf
*/
protected
$cache
=
array
();
/**
* Constructs a MemoryBackend object.
*
* @param string $bin
* The cache bin for which the object is created.
*/
public
function
__construct
(
$bin
)
{
}
/**
* {@inheritdoc}
*/
...
...
core/lib/Drupal/Core/Cache/MemoryBackendFactory.php
View file @
af1abd85
...
...
@@ -16,7 +16,7 @@ class MemoryBackendFactory implements CacheFactoryInterface {
*/
function
get
(
$bin
)
{
if
(
!
isset
(
$this
->
bins
[
$bin
]))
{
$this
->
bins
[
$bin
]
=
new
MemoryBackend
(
$bin
);
$this
->
bins
[
$bin
]
=
new
MemoryBackend
();
}
return
$this
->
bins
[
$bin
];
}
...
...
core/lib/Drupal/Core/Config/StorageComparer.php
View file @
af1abd85
...
...
@@ -101,12 +101,12 @@ class StorageComparer implements StorageComparerInterface {
public
function
__construct
(
StorageInterface
$source_storage
,
StorageInterface
$target_storage
,
ConfigManagerInterface
$config_manager
)
{
// Wrap the storages in a static cache so that multiple reads of the same
// raw configuration object are not costly.
$this
->
sourceCacheStorage
=
new
MemoryBackend
(
__CLASS__
.
'::source'
);
$this
->
sourceCacheStorage
=
new
MemoryBackend
();
$this
->
sourceStorage
=
new
CachedStorage
(
$source_storage
,
$this
->
sourceCacheStorage
);
$this
->
targetCacheStorage
=
new
MemoryBackend
(
__CLASS__
.
'::target'
);
$this
->
targetCacheStorage
=
new
MemoryBackend
();
$this
->
targetStorage
=
new
CachedStorage
(
$target_storage
,
$this
->
targetCacheStorage
...
...
core/modules/hal/tests/src/Kernel/FileNormalizeTest.php
View file @
af1abd85
...
...
@@ -35,7 +35,7 @@ protected function setUp() {
$this
->
installEntitySchema
(
'file'
);
$entity_manager
=
\
Drupal
::
entityManager
();
$link_manager
=
new
LinkManager
(
new
TypeLinkManager
(
new
MemoryBackend
(
'default'
),
\
Drupal
::
moduleHandler
(),
\
Drupal
::
service
(
'config.factory'
),
\
Drupal
::
service
(
'request_stack'
),
\
Drupal
::
service
(
'entity_type.bundle.info'
)),
new
RelationLinkManager
(
new
MemoryBackend
(
'default'
),
$entity_manager
,
\
Drupal
::
moduleHandler
(),
\
Drupal
::
service
(
'config.factory'
),
\
Drupal
::
service
(
'request_stack'
)));
$link_manager
=
new
LinkManager
(
new
TypeLinkManager
(
new
MemoryBackend
(),
\
Drupal
::
moduleHandler
(),
\
Drupal
::
service
(
'config.factory'
),
\
Drupal
::
service
(
'request_stack'
),
\
Drupal
::
service
(
'entity_type.bundle.info'
)),
new
RelationLinkManager
(
new
MemoryBackend
(),
$entity_manager
,
\
Drupal
::
moduleHandler
(),
\
Drupal
::
service
(
'config.factory'
),
\
Drupal
::
service
(
'request_stack'
)));
// Set up the mock serializer.
$normalizers
=
array
(
...
...
core/modules/hal/tests/src/Kernel/NormalizerTestBase.php
View file @
af1abd85
...
...
@@ -131,7 +131,7 @@ protected function setUp() {
])
->
save
();
$entity_manager
=
\
Drupal
::
entityManager
();
$link_manager
=
new
LinkManager
(
new
TypeLinkManager
(
new
MemoryBackend
(
'default'
),
\
Drupal
::
moduleHandler
(),
\
Drupal
::
service
(
'config.factory'
),
\
Drupal
::
service
(
'request_stack'
),
\
Drupal
::
service
(
'entity_type.bundle.info'
)),
new
RelationLinkManager
(
new
MemoryBackend
(
'default'
),
$entity_manager
,
\
Drupal
::
moduleHandler
(),
\
Drupal
::
service
(
'config.factory'
),
\
Drupal
::
service
(
'request_stack'
)));
$link_manager
=
new
LinkManager
(
new
TypeLinkManager
(
new
MemoryBackend
(),
\
Drupal
::
moduleHandler
(),
\
Drupal
::
service
(
'config.factory'
),
\
Drupal
::
service
(
'request_stack'
),
\
Drupal
::
service
(
'entity_type.bundle.info'
)),
new
RelationLinkManager
(
new
MemoryBackend
(),
$entity_manager
,
\
Drupal
::
moduleHandler
(),
\
Drupal
::
service
(
'config.factory'
),
\
Drupal
::
service
(
'request_stack'
)));
$chain_resolver
=
new
ChainEntityResolver
(
array
(
new
UuidResolver
(
$entity_manager
),
new
TargetIdResolver
()));
...
...
core/tests/Drupal/KernelTests/Core/Cache/BackendChainTest.php
View file @
af1abd85
...
...
@@ -17,9 +17,9 @@ protected function createCacheBackend($bin) {
// We need to create some various backends in the chain.
$chain
->
appendBackend
(
new
MemoryBackend
(
'foo'
))
->
prependBackend
(
new
MemoryBackend
(
'bar'
))
->
appendBackend
(
new
MemoryBackend
(
'baz'
));
->
appendBackend
(
new
MemoryBackend
())
->
prependBackend
(
new
MemoryBackend
())
->
appendBackend
(
new
MemoryBackend
());
\
Drupal
::
service
(
'cache_tags.invalidator'
)
->
addInvalidator
(
$chain
);
...
...
core/tests/Drupal/KernelTests/Core/Cache/MemoryBackendTest.php
View file @
af1abd85
...
...
@@ -18,7 +18,7 @@ class MemoryBackendTest extends GenericCacheBackendUnitTestBase {
* A new MemoryBackend object.
*/
protected
function
createCacheBackend
(
$bin
)
{
$backend
=
new
MemoryBackend
(
$bin
);
$backend
=
new
MemoryBackend
();
\
Drupal
::
service
(
'cache_tags.invalidator'
)
->
addInvalidator
(
$backend
);
return
$backend
;
}
...
...
core/tests/Drupal/KernelTests/Core/Path/AliasTest.php
View file @
af1abd85
...
...
@@ -160,7 +160,7 @@ function testWhitelist() {
$connection
=
Database
::
getConnection
();
$this
->
fixtures
->
createTables
(
$connection
);
$memoryCounterBackend
=
new
MemoryCounterBackend
(
'default'
);
$memoryCounterBackend
=
new
MemoryCounterBackend
();
// Create AliasManager and Path object.
$aliasStorage
=
new
AliasStorage
(
$connection
,
$this
->
container
->
get
(
'module_handler'
));
...
...
core/tests/Drupal/KernelTests/Core/Plugin/PluginTestBase.php
View file @
af1abd85
...
...
@@ -42,7 +42,7 @@ protected function setUp() {
// as derivatives and ReflectionFactory.
$this
->
testPluginManager
=
new
TestPluginManager
();
$this
->
mockBlockManager
=
new
MockBlockManager
();
$module_handler
=
new
ModuleHandler
(
\
Drupal
::
root
(),
array
(),
new
MemoryBackend
(
'plugin'
),
$this
->
container
->
get
(
'event_dispatcher'
));
$module_handler
=
new
ModuleHandler
(
\
Drupal
::
root
(),
array
(),
new
MemoryBackend
(),
$this
->
container
->
get
(
'event_dispatcher'
));
$this
->
defaultsTestPluginManager
=
new
DefaultsTestPluginManager
(
$module_handler
);
// The expected plugin definitions within each manager. Several tests assert
...
...
core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php
View file @
af1abd85
...
...
@@ -83,7 +83,7 @@ protected function setUp() {
$this
->
fixtures
=
new
RoutingFixtures
();
$this
->
state
=
new
State
(
new
KeyValueMemoryFactory
());
$this
->
currentPath
=
new
CurrentPathStack
(
new
RequestStack
());
$this
->
cache
=
new
MemoryBackend
(
'data'
);
$this
->
cache
=
new
MemoryBackend
();
$this
->
pathProcessor
=
\
Drupal
::
service
(
'path_processor_manager'
);
$this
->
cacheTagsInvalidator
=
\
Drupal
::
service
(
'cache_tags.invalidator'
);
}
...
...
core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php
View file @
af1abd85
...
...
@@ -106,7 +106,7 @@ protected function setUp() {
$this
->
languageManager
->
expects
(
$this
->
any
())
->
method
(
'getCurrentLanguage'
)
->
will
(
$this
->
onConsecutiveCalls
(
$english
,
$english
,
$japanese
,
$japanese
));
$this
->
cache
=
new
TestMemoryBackend
(
'llama'
);
$this
->
cache
=
new
TestMemoryBackend
();
$this
->
assetResolver
=
new
AssetResolver
(
$this
->
libraryDiscovery
,
$this
->
libraryDependencyResolver
,
$this
->
moduleHandler
,
$this
->
themeManager
,
$this
->
languageManager
,
$this
->
cache
);
}
...
...
core/tests/Drupal/Tests/Core/Cache/BackendChainImplementationUnitTest.php
View file @
af1abd85
...
...
@@ -46,9 +46,9 @@ protected function setUp() {
parent
::
setUp
();
// Set up three memory backends to be used in the chain.
$this
->
firstBackend
=
new
MemoryBackend
(
'foo'
);
$this
->
secondBackend
=
new
MemoryBackend
(
'bar'
);
$this
->
thirdBackend
=
new
MemoryBackend
(
'baz'
);
$this
->
firstBackend
=
new
MemoryBackend
();
$this
->
secondBackend
=
new
MemoryBackend
();
$this
->
thirdBackend
=
new
MemoryBackend
();
// Set an initial fixed dataset for all testing. The next three data
// collections will test two edge cases (last backend has the data, and
...
...
core/tests/Drupal/Tests/Core/Cache/ChainedFastBackendTest.php
View file @
af1abd85
...
...
@@ -62,7 +62,7 @@ public function testGetDoesntHitConsistentBackend() {
$consistent_cache
->
expects
(
$this
->
never
())
->
method
(
'getMultiple'
);
$fast_cache
=
new
MemoryBackend
(
'foo'
);
$fast_cache
=
new
MemoryBackend
();
$fast_cache
->
set
(
'foo'
,
'baz'
);
$chained_fast_backend
=
new
ChainedFastBackend
(
...
...
core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php
View file @
af1abd85
...
...
@@ -79,8 +79,8 @@ public function testContextBubblingCustomCacheBin() {
$bin
=
$this
->
randomMachineName
();
$this
->
setUpRequest
();
$this
->
memoryCache
=
new
MemoryBackend
(
'render'
);
$custom_cache
=
new
MemoryBackend
(
$bin
);
$this
->
memoryCache
=
new
MemoryBackend
();
$custom_cache
=
new
MemoryBackend
();
$this
->
cacheFactory
->
expects
(
$this
->
atLeastOnce
())
->
method
(
'get'
)
...
...
core/tests/Drupal/Tests/Core/Render/RendererTestBase.php
View file @
af1abd85
...
...
@@ -208,7 +208,7 @@ protected function setUpUnusedCache() {
* Sets up a memory-based render cache back-end.
*/
protected
function
setupMemoryCache
()
{
$this
->
memoryCache
=
$this
->
memoryCache
?:
new
MemoryBackend
(
'render'
);
$this
->
memoryCache
=
$this
->
memoryCache
?:
new
MemoryBackend
();
$this
->
cacheFactory
->
expects
(
$this
->
atLeastOnce
())
->
method
(
'get'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment