Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cdn
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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
cdn
Merge requests
!31
Resolve
#3445095
"Responsive image test 5.x"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Resolve
#3445095
"Responsive image test 5.x"
issue/cdn-3445095:3445095-responsive_image_test-5.x
into
5.x
Overview
0
Commits
4
Pipelines
3
Changes
2
Open
Wim Leers
requested to merge
issue/cdn-3445095:3445095-responsive_image_test-5.x
into
5.x
1 year ago
Overview
0
Commits
4
Pipelines
3
Changes
2
Expand
Closes
#3445095
0
0
Merge request reports
Compare
5.x
version 2
e19fb656
1 year ago
version 1
48ae72b8
1 year ago
5.x (HEAD)
and
latest version
latest version
1abce881
4 commits,
1 year ago
version 2
e19fb656
3 commits,
1 year ago
version 1
48ae72b8
2 commits,
1 year ago
2 files
+
82
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
tests/src/Functional/ResponsiveImageFieldDisplayTest.php
0 → 100644
+
68
−
0
Options
<?php
declare
(
strict_types
=
1
);
namespace
Drupal\Tests\cdn\Functional
;
use
Drupal\Core\Extension\ModuleHandlerInterface
;
use
Drupal\Core\File\FileUrlGeneratorInterface
;
use
Drupal\Tests\responsive_image
\Functional\ResponsiveImageFieldDisplayTest
as
CoreTest
;
use
Drupal\Tests\UiHelperTrait
;
/**
* @group cdn
*/
class
ResponsiveImageFieldDisplayTest
extends
CoreTest
{
use
UiHelperTrait
{
buildUrl
as
coreBuildUrlWithBrokenSchemeLessUrlSupport
;
}
/**
* {@inheritdoc}
*/
protected
static
$modules
=
[
'cdn'
];
/**
* {@inheritdoc}
*/
protected
function
setUp
():
void
{
parent
::
setUp
();
// Configure CDN integration.
$this
->
config
(
'cdn.settings'
)
->
set
(
'mapping'
,
[
'type'
=>
'simple'
,
// Specify a host that resolves in the test environment.
'domain'
=>
parse_url
(
$GLOBALS
[
'base_url'
],
PHP_URL_HOST
),
'conditions'
=>
[],
])
->
set
(
'status'
,
TRUE
)
// Disable the farfuture functionality: simpler file URL assertions.
->
set
(
'farfuture'
,
[
'status'
=>
FALSE
])
->
save
();
// Rebuild the container to ensure the reconstructed `CdnSettings` service
// is used by the CDN module's file URL generator decorator service.
$this
->
rebuildContainer
();
$this
->
fileUrlGenerator
=
$this
->
container
->
get
(
FileUrlGeneratorInterface
::
class
);
// TRICKY: necessary to avoid triggering an exception in ThemeManager.
// @see \Drupal\Core\Theme\ThemeManager::render()
$this
->
container
->
get
(
ModuleHandlerInterface
::
class
)
->
reload
();
}
/**
* {@inheritdoc}
*/
protected
function
buildUrl
(
$path
,
array
$options
=
[])
{
// @todo Remove this when \Drupal\Tests\UiHelperTrait::buildUrl() is fixed.
// Support scheme-relative URLs.
if
(
is_string
(
$path
)
&&
str_starts_with
(
$path
,
'//'
))
{
return
$path
;
}
return
$this
->
coreBuildUrlWithBrokenSchemeLessUrlSupport
(
$path
,
$options
);
}
}
Loading