Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
F
facets
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
8
Merge Requests
8
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
facets
Commits
3b27b114
Commit
3b27b114
authored
May 31, 2018
by
borisson_
Committed by
borisson_
May 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2973743
by borisson_: Fix tests
parent
f3ae4113
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
19 deletions
+92
-19
modules/facets_rest/tests/rest_view/config/install/views.view.search_api_rest_test_view.yml
...w/config/install/views.view.search_api_rest_test_view.yml
+0
-0
modules/facets_rest/tests/src/Functional/RestIntegrationTest.php
.../facets_rest/tests/src/Functional/RestIntegrationTest.php
+91
-18
tests/facets_search_api_dependency/config/install/views.view.search_api_test_view.yml
...ndency/config/install/views.view.search_api_test_view.yml
+0
-0
tests/src/Kernel/Entity/FacetFacetSourceTest.php
tests/src/Kernel/Entity/FacetFacetSourceTest.php
+1
-1
No files found.
modules/facets_rest/tests/rest_view/config/install/views.view.search_api_
test_views_fulltext
.yml
→
modules/facets_rest/tests/rest_view/config/install/views.view.search_api_
rest_test_view
.yml
View file @
3b27b114
File moved
modules/facets_rest/tests/src/Functional/RestIntegrationTest.php
View file @
3b27b114
...
...
@@ -122,49 +122,88 @@ class RestIntegrationTest extends FacetsTestBase {
// Verify the facet "Type".
$results
=
[
'article'
=>
[
'url'
=>
$base_url
.
'/facets-rest?_format=json&f%5B0%5D=type%3Aarticle'
,
'url'
=>
[
$base_url
,
'/facets-rest'
,
'_format=json'
,
'f%5B0%5D=type%3Aarticle'
,
],
'count'
=>
2
,
],
'item'
=>
[
'url'
=>
$base_url
.
'/facets-rest?_format=json&f%5B0%5D=type%3Aitem'
,
'url'
=>
[
$base_url
,
'/facets-rest'
,
'_format=json'
,
'f%5B0%5D=type%3Aitem'
,
],
'count'
=>
3
,
],
];
foreach
(
$json_decoded
->
facets
[
1
][
0
]
->
type
as
$result
)
{
$value
=
$result
->
values
->
value
;
$this
->
assertEquals
(
$result
->
url
,
$results
[
$value
][
'url'
]);
$this
->
assertEquals
(
$result
->
values
->
count
,
$results
[
$value
][
'count'
]);
foreach
(
$results
[
$value
][
'url'
]
as
$url_part
)
{
$this
->
assertNotFalse
(
strpos
(
$result
->
url
,
$url_part
));
}
}
// Verify the facet "Keywords".
$results
=
[
'banana'
=>
[
'url'
=>
$base_url
.
'/facets-rest?_format=json&f%5B0%5D=keywords%3Abanana'
,
'url'
=>
[
$base_url
,
'/facets-rest'
,
'_format=json'
,
'f%5B0%5D=keywords%3Abanana'
,
],
'count'
=>
1
,
],
'strawberry'
=>
[
'url'
=>
$base_url
.
'/facets-rest?_format=json&f%5B0%5D=keywords%3Astrawberry'
,
'url'
=>
[
$base_url
,
'/facets-rest'
,
'_format=json'
,
'f%5B0%5D=keywords%3Astrawberry'
,
],
'count'
=>
2
,
],
'apple'
=>
[
'url'
=>
$base_url
.
'/facets-rest?_format=json&f%5B0%5D=keywords%3Aapple'
,
'url'
=>
[
$base_url
,
'/facets-rest'
,
'_format=json'
,
'f%5B0%5D=keywords%3Aapple'
,
],
'count'
=>
2
,
],
'orange'
=>
[
'url'
=>
$base_url
.
'/facets-rest?_format=json&f%5B0%5D=keywords%3Aorange'
,
'url'
=>
[
$base_url
,
'/facets-rest'
,
'_format=json'
,
'f%5B0%5D=keywords%3Aorange'
,
],
'count'
=>
3
,
],
'grape'
=>
[
'url'
=>
$base_url
.
'/facets-rest?_format=json&f%5B0%5D=keywords%3Agrape'
,
'url'
=>
[
$base_url
,
'/facets-rest'
,
'_format=json'
,
'f%5B0%5D=keywords%3Agrape'
,
],
'count'
=>
3
,
],
];
foreach
(
$json_decoded
->
facets
[
0
][
0
]
->
keywords
as
$result
)
{
$value
=
$result
->
values
->
value
;
$this
->
assertEquals
(
$result
->
url
,
$results
[
$value
][
'url'
]);
$this
->
assertEquals
(
$result
->
values
->
count
,
$results
[
$value
][
'count'
]);
foreach
(
$results
[
$value
][
'url'
]
as
$url_part
)
{
$this
->
assertNotFalse
(
strpos
(
$result
->
url
,
$url_part
));
}
}
// Filter and verify that the results are correct.
...
...
@@ -177,45 +216,79 @@ class RestIntegrationTest extends FacetsTestBase {
$results
=
[
'article'
=>
[
'url'
=>
$base_url
.
'/facets-rest?_format=json&f%5B0%5D=type%3Aitem&f%5B1%5D=type%3Aarticle'
,
'url'
=>
[
$base_url
,
'/facets-rest'
,
'_format=json'
,
'f%5B0%5D=type%3Aitem&f%5B1%5D=type%3Aarticle'
,
],
'count'
=>
2
,
],
'item'
=>
[
'url'
=>
$base_url
.
'/facets-rest?_format=json&'
,
'url'
=>
[
$base_url
,
'/facets-rest'
,
'_format=json'
]
,
'count'
=>
3
,
],
'banana'
=>
[
'url'
=>
$base_url
.
'/facets-rest?_format=json&f%5B0%5D=type%3Aitem&f%5B1%5D=keywords%3Abanana'
,
'url'
=>
[
$base_url
,
'/facets-rest'
,
'_format=json'
,
'f%5B0%5D=type%3Aitem&f%5B1%5D=keywords%3Abanana'
,
],
'count'
=>
0
,
],
'strawberry'
=>
[
'url'
=>
$base_url
.
'/facets-rest?_format=json&f%5B0%5D=type%3Aitem&f%5B1%5D=keywords%3Astrawberry'
,
'url'
=>
[
$base_url
,
'/facets-rest'
,
'_format=json'
,
'f%5B0%5D=type%3Aitem&f%5B1%5D=keywords%3Astrawberry'
,
],
'count'
=>
0
,
],
'apple'
=>
[
'url'
=>
$base_url
.
'/facets-rest?_format=json&f%5B0%5D=type%3Aitem&f%5B1%5D=keywords%3Aapple'
,
'url'
=>
[
$base_url
,
'/facets-rest'
,
'_format=json'
,
'f%5B0%5D=type%3Aitem&f%5B1%5D=keywords%3Aapple'
,
],
'count'
=>
1
,
],
'orange'
=>
[
'url'
=>
$base_url
.
'/facets-rest?_format=json&f%5B0%5D=type%3Aitem&f%5B1%5D=keywords%3Aorange'
,
'url'
=>
[
$base_url
,
'/facets-rest'
,
'_format=json'
,
'f%5B0%5D=type%3Aitem&f%5B1%5D=keywords%3Aorange'
,
],
'count'
=>
2
,
],
'grape'
=>
[
'url'
=>
$base_url
.
'/facets-rest?_format=json&f%5B0%5D=type%3Aitem&f%5B1%5D=keywords%3Agrape'
,
'url'
=>
[
$base_url
,
'/facets-rest'
,
'_format=json'
,
'f%5B0%5D=type%3Aitem&f%5B1%5D=keywords%3Agrape'
,
],
'count'
=>
1
,
],
];
foreach
(
$json_decoded
->
facets
[
1
][
0
]
->
type
as
$result
)
{
$value
=
$result
->
values
->
value
;
$this
->
assertEquals
(
$results
[
$value
][
'url'
],
$result
->
url
);
$this
->
assertEquals
(
$results
[
$value
][
'count'
],
$result
->
values
->
count
);
foreach
(
$results
[
$value
][
'url'
]
as
$url_part
)
{
$this
->
assertNotFalse
(
strpos
(
$result
->
url
,
$url_part
));
}
}
foreach
(
$json_decoded
->
facets
[
0
][
0
]
->
keywords
as
$result
)
{
$value
=
$result
->
values
->
value
;
$this
->
assertEquals
(
$results
[
$value
][
'url'
],
$result
->
url
);
$this
->
assertEquals
(
$results
[
$value
][
'count'
],
$result
->
values
->
count
);
foreach
(
$results
[
$value
][
'url'
]
as
$url_part
)
{
$this
->
assertNotFalse
(
strpos
(
$result
->
url
,
$url_part
));
}
}
}
...
...
tests/facets_search_api_dependency/config/install/views.view.search_api_test_view
s_fulltext
.yml
→
tests/facets_search_api_dependency/config/install/views.view.search_api_test_view.yml
View file @
3b27b114
File moved
tests/src/Kernel/Entity/FacetFacetSourceTest.php
View file @
3b27b114
...
...
@@ -195,7 +195,7 @@ class FacetFacetSourceTest extends EntityKernelTestBase {
/**
* Test the data definitions.
*
* @covers \Drupal\facets\
FacetSource\FacetSourcePluginInterface
::getDataDefinition
* @covers \Drupal\facets\
Plugin\facets\facet_source\SearchApiDisplay
::getDataDefinition
*/
public
function
testDataDefinitions
()
{
// Create and configure facet.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment