Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
225
Merge Requests
225
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
722c8dd2
Commit
722c8dd2
authored
Jan 22, 2015
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2409247
by znerol: Generated proxy classes break DrupalKernelTest when running from the UI
parent
ba831b2c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
7 deletions
+42
-7
core/lib/Drupal/Core/DrupalKernel.php
core/lib/Drupal/Core/DrupalKernel.php
+19
-7
core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php
...odules/system/src/Tests/DrupalKernel/DrupalKernelTest.php
+23
-0
No files found.
core/lib/Drupal/Core/DrupalKernel.php
View file @
722c8dd2
...
...
@@ -667,6 +667,15 @@ protected function getClassName() {
return
implode
(
'_'
,
$parts
);
}
/**
* Returns the container class namespace based on the environment.
*
* @return string
* The class name.
*/
protected
function
getClassNamespace
()
{
return
'Drupal\\Core\\DependencyInjection\\Container\\'
.
$this
->
environment
;
}
/**
* Returns the kernel parameters.
...
...
@@ -704,16 +713,14 @@ protected function initializeContainer($rebuild = FALSE) {
// If the module list hasn't already been set in updateModules and we are
// not forcing a rebuild, then try and load the container from the disk.
if
(
empty
(
$this
->
moduleList
)
&&
!
$rebuild
)
{
$class
=
$this
->
getClassName
();
$cache_file
=
$class
.
'.php'
;
$fully_qualified_class_name
=
'\\'
.
$this
->
getClassNamespace
()
.
'\\'
.
$this
->
getClassName
();
// First, try to load from storage.
if
(
!
class_exists
(
$
class
,
FALSE
))
{
$this
->
storage
()
->
load
(
$
cache_file
);
if
(
!
class_exists
(
$
fully_qualified_class_name
,
FALSE
))
{
$this
->
storage
()
->
load
(
$
this
->
getClassName
()
.
'.php'
);
}
// If the load succeeded or the class already existed, use it.
if
(
class_exists
(
$class
,
FALSE
))
{
$fully_qualified_class_name
=
'\\'
.
$class
;
if
(
class_exists
(
$fully_qualified_class_name
,
FALSE
))
{
$container
=
new
$fully_qualified_class_name
;
}
}
...
...
@@ -1093,7 +1100,12 @@ protected function dumpDrupalContainer(ContainerBuilder $container, $baseClass)
$dumper
=
new
PhpDumper
(
$container
);
$dumper
->
setProxyDumper
(
new
ProxyDumper
(
new
ProxyBuilder
()));
$class
=
$this
->
getClassName
();
$content
=
$dumper
->
dump
(
array
(
'class'
=>
$class
,
'base_class'
=>
$baseClass
));
$namespace
=
$this
->
getClassNamespace
();
$content
=
$dumper
->
dump
([
'class'
=>
$class
,
'base_class'
=>
$baseClass
,
'namespace'
=>
$namespace
,
]);
return
$this
->
storage
()
->
save
(
$class
.
'.php'
,
$content
);
}
...
...
core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php
View file @
722c8dd2
...
...
@@ -153,4 +153,27 @@ public function testCompileDIC() {
));
}
/**
* Test repeated loading of compiled DIC with different environment.
*/
public
function
testRepeatedBootWithDifferentEnvironment
()
{
$request
=
Request
::
createFromGlobals
();
$class_loader
=
require
DRUPAL_ROOT
.
'/core/vendor/autoload.php'
;
$environments
=
[
'testing1'
,
'testing1'
,
'testing2'
,
'testing2'
,
];
foreach
(
$environments
as
$environment
)
{
$kernel
=
DrupalKernel
::
createFromRequest
(
$request
,
$class_loader
,
$environment
);
$this
->
settingsSet
(
'hash_salt'
,
$this
->
databasePrefix
);
$kernel
->
boot
();
}
$this
->
pass
(
'Repeatedly loaded compiled DIC with different environment'
);
}
}
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