Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
facets-3052574
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Issue forks
facets-3052574
Commits
d4fc586b
Commit
d4fc586b
authored
2 years ago
by
Ide Braakman
Committed by
Markus Kalkbrenner
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3327629
: Replace custom assertCacheabillityArrays with PHPUnit's assertEqualsCanonicalizing
parent
d6ffb6ec
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/src/Kernel/FacetManager/DefaultFacetManagerTest.php
+6
-22
6 additions, 22 deletions
tests/src/Kernel/FacetManager/DefaultFacetManagerTest.php
with
6 additions
and
22 deletions
tests/src/Kernel/FacetManager/DefaultFacetManagerTest.php
+
6
−
22
View file @
d4fc586b
...
...
@@ -179,8 +179,8 @@ class DefaultFacetManagerTest extends EntityKernelTestBase {
// Make sure that query cachebillity will include facets cache tags e.g.
// view results will depends on the facet configuration.
$this
->
facetManager
->
alterQuery
(
$query
,
$facet_source
);
$this
->
assert
CacheabillityArrays
(
$expected_contexts
,
$query
->
getCacheContexts
());
$this
->
assert
CacheabillityArrays
(
$expected_tags
,
$query
->
getCacheTags
());
$this
->
assert
EqualsCanonicalizing
(
$expected_contexts
,
$query
->
getCacheContexts
());
$this
->
assert
EqualsCanonicalizing
(
$expected_tags
,
$query
->
getCacheTags
());
}
/**
...
...
@@ -219,8 +219,8 @@ class DefaultFacetManagerTest extends EntityKernelTestBase {
$metadata
=
CacheableMetadata
::
createFromObject
(
$facet
);
$metadata
->
applyTo
(
$build
);
$this
->
assertEquals
(
$expected_metadata
[
'max-age'
],
$build
[
'#cache'
][
'max-age'
]);
$this
->
assert
CacheabillityArrays
(
$expected_metadata
[
'contexts'
],
$build
[
'#cache'
][
'contexts'
]);
$this
->
assert
CacheabillityArrays
(
$expected_metadata
[
'tags'
],
$build
[
'#cache'
][
'tags'
]);
$this
->
assert
EqualsCanonicalizing
(
$expected_metadata
[
'contexts'
],
$build
[
'#cache'
][
'contexts'
]);
$this
->
assert
EqualsCanonicalizing
(
$expected_metadata
[
'tags'
],
$build
[
'#cache'
][
'tags'
]);
$facet
->
removeProcessor
(
'fpc_sort_processor'
);
// Test that un-cacheable plugin kills the cache.
...
...
@@ -238,8 +238,8 @@ class DefaultFacetManagerTest extends EntityKernelTestBase {
$metadata
->
applyTo
(
$build
);
$this
->
assertEquals
(
0
,
$build
[
'#cache'
][
'max-age'
]);
$this
->
assert
CacheabillityArrays
(
$expected_metadata
[
'contexts'
],
$build
[
'#cache'
][
'contexts'
]);
$this
->
assert
CacheabillityArrays
(
$expected_metadata
[
'tags'
],
$build
[
'#cache'
][
'tags'
]);
$this
->
assert
EqualsCanonicalizing
(
$expected_metadata
[
'contexts'
],
$build
[
'#cache'
][
'contexts'
]);
$this
->
assert
EqualsCanonicalizing
(
$expected_metadata
[
'tags'
],
$build
[
'#cache'
][
'tags'
]);
}
/**
...
...
@@ -294,22 +294,6 @@ class DefaultFacetManagerTest extends EntityKernelTestBase {
}
}
/**
* Assert that actual cachebillity matches expected one.
*/
public
function
assertCacheabillityArrays
(
$expected
,
$actual
,
string
$message
=
''
):
void
{
foreach
([
&
$expected
,
&
$actual
]
as
&
$array
)
{
foreach
(
$array
as
&
$value
)
{
if
(
is_array
(
$value
))
{
sort
(
$value
);
}
}
}
sort
(
$expected
);
sort
(
$actual
);
$this
->
assertEquals
(
$expected
,
$actual
,
$message
);
}
/**
* Data provider for testBuildCacheabilityMetadata().
*
...
...
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