Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
722c8dd2
Commit
722c8dd2
authored
Jan 22, 2015
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2409247
by znerol: Generated proxy classes break DrupalKernelTest when running from the UI
parent
ba831b2c
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/lib/Drupal/Core/DrupalKernel.php
+19
-7
19 additions, 7 deletions
core/lib/Drupal/Core/DrupalKernel.php
core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php
+23
-0
23 additions, 0 deletions
...odules/system/src/Tests/DrupalKernel/DrupalKernelTest.php
with
42 additions
and
7 deletions
core/lib/Drupal/Core/DrupalKernel.php
+
19
−
7
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
);
}
...
...
This diff is collapsed.
Click to expand it.
core/modules/system/src/Tests/DrupalKernel/DrupalKernelTest.php
+
23
−
0
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'
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment