Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
search_api
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
search_api
Commits
1696c211
There was an error fetching the commit references. Please try again later.
Commit
1696c211
authored
1 year ago
by
eduardo morales alberti
Committed by
Thomas Seidl
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3263875
by Eduardo Morales Alberti, drunken monkey, GrumpySchlag: Fixed Behat integration.
parent
6ce3d21e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.txt
+2
-0
2 additions, 0 deletions
CHANGELOG.txt
search_api.behat.inc
+33
-1
33 additions, 1 deletion
search_api.behat.inc
with
35 additions
and
1 deletion
CHANGELOG.txt
+
2
−
0
View file @
1696c211
Search API 1.x, dev (xxxx-xx-xx):
---------------------------------
- #3263875 by Eduardo Morales Alberti, drunken monkey, GrumpySchlag: Fixed Behat
integration.
- #3355677 by drunken monkey: Fixed incompatibility with PHP 7.3 in
ConfigurablePropertyBase.
- #3358819 by drunken monkey: Fixed tests against Drupal 10.1.
...
...
This diff is collapsed.
Click to expand it.
search_api.behat.inc
+
33
−
1
View file @
1696c211
...
...
@@ -6,6 +6,7 @@
*/
use
Behat\Behat\Hook\Scope\AfterStepScope
;
use
Behat\Gherkin\Node\FeatureNode
;
use
Drupal\DrupalExtension\Context\DrupalSubContextBase
;
/**
...
...
@@ -15,6 +16,15 @@ use Drupal\DrupalExtension\Context\DrupalSubContextBase;
*/
class
SearchApiSubContext
extends
DrupalSubContextBase
{
/**
* Cached tags lists of features, keyed by feature hash.
*
* @var string[][]
*
* @see \SearchApiSubContext::getTagsFromFeature()
*/
protected
static
$tags
;
/**
* Triggers all queued indexing operations for this page request.
*
...
...
@@ -39,7 +49,7 @@ class SearchApiSubContext extends DrupalSubContextBase {
* @AfterStep
*/
public
function
indexEntities
(
AfterStepScope
$event
)
{
$tags
=
$event
->
getFeature
()
->
getTags
(
);
$tags
=
static
::
getTagsFromFeature
(
$event
->
getFeature
());
if
(
!
in_array
(
'search_api'
,
$tags
))
{
return
;
}
...
...
@@ -48,4 +58,26 @@ class SearchApiSubContext extends DrupalSubContextBase {
->
destruct
();
}
/**
* Extracts tags from a feature.
*
* @param \Behat\Gherkin\Node\FeatureNode $feature
* Feature node from which to extract the tags.
*
* @return string[]
* The tags list of the feature.
*/
public
static
function
getTagsFromFeature
(
FeatureNode
$feature
):
array
{
$feature_hash
=
md5
(
$feature
->
getFile
());
if
(
!
isset
(
static
::
$tags
[
$feature_hash
]))
{
$tags
=
[];
foreach
(
$feature
->
getScenarios
()
as
$scenario
)
{
$scenario_tags
=
$scenario
->
getTags
();
$tags
=
array_unique
(
array_merge
(
$tags
,
$scenario_tags
),
SORT_REGULAR
);
}
static
::
$tags
[
$feature_hash
]
=
$tags
;
}
return
static
::
$tags
[
$feature_hash
];
}
}
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