Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal_cms
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
drupal_cms
Commits
3c5152d3
Commit
3c5152d3
authored
3 months ago
by
Adam G-H
Browse files
Options
Downloads
Patches
Plain Diff
Add a test that all image styles convert to WebP.
parent
4ec07821
No related branches found
No related tags found
No related merge requests found
Pipeline
#413534
failed
3 months ago
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dev.composer.json
+2
-1
2 additions, 1 deletion
dev.composer.json
recipes/drupal_cms_image/tests/src/Functional/ComponentValidationTest.php
+19
-0
19 additions, 0 deletions
...ms_image/tests/src/Functional/ComponentValidationTest.php
with
21 additions
and
1 deletion
dev.composer.json
+
2
−
1
View file @
3c5152d3
...
...
@@ -103,7 +103,8 @@
},
"require-dev"
:
{
"drupal/core-dev"
:
"^11.1.1"
,
"drupal/default_content"
:
"^2"
"drupal/default_content"
:
"^2"
,
"symfony/polyfill-php84"
:
"*"
},
"autoload-dev"
:
{
"files"
:
[
...
...
This diff is collapsed.
Click to expand it.
recipes/drupal_cms_image/tests/src/Functional/ComponentValidationTest.php
+
19
−
0
View file @
3c5152d3
...
...
@@ -5,6 +5,8 @@ declare(strict_types=1);
namespace
Drupal\Tests\drupal_cms_image\Functional
;
use
Drupal\FunctionalTests\Core\Recipe\RecipeTestTrait
;
use
Drupal\image\Entity\ImageStyle
;
use
Drupal\image\ImageStyleInterface
;
use
Drupal\Tests\BrowserTestBase
;
/**
...
...
@@ -26,6 +28,23 @@ class ComponentValidationTest extends BrowserTestBase {
$this
->
applyRecipe
(
$dir
);
// Apply it again to prove that it is idempotent.
$this
->
applyRecipe
(
$dir
);
$image_styles
=
ImageStyle
::
loadMultiple
();
$predicate
=
function
(
ImageStyleInterface
$image_style
):
bool
{
foreach
(
$image_style
->
getEffects
()
as
$effect
)
{
if
(
$effect
->
getPluginId
()
===
'image_convert'
)
{
$configuration
=
$effect
->
getConfiguration
();
if
(
$configuration
[
'extension'
]
===
'webp'
)
{
return
TRUE
;
}
}
}
return
FALSE
;
};
$this
->
assertTrue
(
array_all
(
$image_styles
,
$predicate
),
'Not all image styles include a conversion to WebP.'
,
);
}
}
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