Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
experience_builder
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
experience_builder
Merge requests
!406
Draft:
#3487284
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Draft:
#3487284
issue/experience_builder-3487284:3487284-discover-cases-where
into
0.x
Overview
0
Commits
1
Pipelines
1
Changes
1
Open
Dave Long
requested to merge
issue/experience_builder-3487284:3487284-discover-cases-where
into
0.x
4 months ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
Closes
#3487284
0
0
Merge request reports
Compare
0.x
0.x (HEAD)
and
latest version
latest version
21987a1f
1 commit,
4 months ago
1 file
+
10
−
12
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
tests/src/Kernel/PropShapeRepositoryTest.php
+
10
−
12
Options
@@ -69,11 +69,7 @@ class PropShapeRepositoryTest extends KernelTestBase {
* Tests finding all unique prop schemas.
*/
public
function
testUniquePropSchemaDiscovery
():
array
{
$sdc_manager
=
\Drupal
::
service
(
'plugin.manager.sdc'
);
$matcher
=
\Drupal
::
service
(
SdcPropToFieldTypePropMatcher
::
class
);
assert
(
$matcher
instanceof
SdcPropToFieldTypePropMatcher
);
$components
=
$sdc_manager
->
getAllComponents
();
$components
=
\Drupal
::
service
(
'plugin.manager.sdc'
)
->
getAllComponents
();
$unique_prop_shapes
=
[];
foreach
(
$components
as
$component
)
{
foreach
(
PropShape
::
getComponentProps
(
$component
)
as
$prop_shape
)
{
@@ -490,22 +486,24 @@ class PropShapeRepositoryTest extends KernelTestBase {
$this
->
assertNotEmpty
(
$unique_prop_shapes
);
$unique_storable_prop_shapes
=
[];
$unstorable_prop_shapes
=
[];
foreach
(
$unique_prop_shapes
as
$prop_shape
)
{
assert
(
$prop_shape
instanceof
PropShape
);
// If this prop shape is not storable, then fall back to the PropShape
// object, to make it easy to assert which shapes are storable vs not.
$unique_storable_prop_shapes
[
$prop_shape
->
uniquePropSchemaKey
()]
=
$prop_shape
->
getStorage
()
??
$prop_shape
;
$key
=
$prop_shape
->
uniquePropSchemaKey
();
if
(
$prop_shape_storage
=
$prop_shape
->
getStorage
())
{
$unique_storable_prop_shapes
[
$key
]
=
$prop_shape_storage
;
}
else
{
$unstorable_prop_shapes
[
$key
]
=
$prop_shape
;
}
}
$unstorable_prop_shapes
=
array_filter
(
$unique_storable_prop_shapes
,
fn
(
$s
)
=>
$s
instanceof
PropShape
);
$unique_storable_prop_shapes
=
array_filter
(
$unique_storable_prop_shapes
,
fn
(
$s
)
=>
$s
instanceof
StorablePropShape
);
$this
->
assertEquals
(
static
::
getExpectedStorablePropShapes
(),
$unique_storable_prop_shapes
);
// ⚠️ No field type + widget yet for these! For some that is fine though.
$this
->
assertEquals
(
static
::
getExpectedUnstorablePropShapes
(),
$unstorable_prop_shapes
);
return
array_filter
(
$unique_storable_prop_shapes
,
fn
(
$prop_shape
)
=>
$prop_shape
instanceof
StorablePropShape
)
;
return
$unique_storable_prop_shapes
;
}
/**
Loading