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
6
Merge Requests
6
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
984aff62
Commit
984aff62
authored
Jul 21, 2017
by
borisson_
Committed by
borisson_
Jul 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2896175
by borisson_: Fix phpcs errors
parent
e54263e2
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
61 additions
and
48 deletions
+61
-48
modules/facets_range_widget/js/slider.js
modules/facets_range_widget/js/slider.js
+1
-0
modules/facets_range_widget/tests/src/Functional/SliderIntegrationTest.php
...nge_widget/tests/src/Functional/SliderIntegrationTest.php
+1
-1
modules/facets_summary/src/FacetsSummaryManager/DefaultFacetsSummaryManager.php
.../src/FacetsSummaryManager/DefaultFacetsSummaryManager.php
+2
-2
modules/facets_summary/src/Plugin/facets_summary/processor/ResetFacetsProcessor.php
.../Plugin/facets_summary/processor/ResetFacetsProcessor.php
+1
-1
modules/facets_summary/tests/src/Functional/IntegrationTest.php
...s/facets_summary/tests/src/Functional/IntegrationTest.php
+0
-1
src/Entity/FacetSource.php
src/Entity/FacetSource.php
+1
-0
src/FacetListBuilder.php
src/FacetListBuilder.php
+18
-19
src/FacetManager/DefaultFacetManager.php
src/FacetManager/DefaultFacetManager.php
+1
-1
src/FacetSource/FacetSourcePluginInterface.php
src/FacetSource/FacetSourcePluginInterface.php
+2
-1
src/FacetSource/FacetSourcePluginManager.php
src/FacetSource/FacetSourcePluginManager.php
+1
-1
src/FacetSource/SearchApiFacetSourceInterface.php
src/FacetSource/SearchApiFacetSourceInterface.php
+1
-1
src/Form/FacetCloneForm.php
src/Form/FacetCloneForm.php
+11
-1
src/Form/FacetSourceEditForm.php
src/Form/FacetSourceEditForm.php
+2
-2
src/Plugin/facets/facet_source/SearchApiDisplay.php
src/Plugin/facets/facet_source/SearchApiDisplay.php
+0
-1
tests/facets_custom_widget/src/Plugin/facets/processor/TestPreQuery.php
...ustom_widget/src/Plugin/facets/processor/TestPreQuery.php
+2
-2
tests/facets_query_processor/src/Plugin/facets/url_processor/DummyQuery.php
..._processor/src/Plugin/facets/url_processor/DummyQuery.php
+2
-0
tests/src/Functional/BreadcrumbIntegrationTest.php
tests/src/Functional/BreadcrumbIntegrationTest.php
+3
-3
tests/src/Functional/FacetSourceTest.php
tests/src/Functional/FacetSourceTest.php
+1
-0
tests/src/Unit/Plugin/processor/DependentFacetProcessorTest.php
...src/Unit/Plugin/processor/DependentFacetProcessorTest.php
+1
-0
tests/src/Unit/Plugin/processor/TranslateEntityProcessorTest.php
...rc/Unit/Plugin/processor/TranslateEntityProcessorTest.php
+10
-11
No files found.
modules/facets_range_widget/js/slider.js
View file @
984aff62
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
* @file
* @file
* Provides the slider functionality.
* Provides the slider functionality.
*/
*/
(
function
(
$
)
{
(
function
(
$
)
{
'
use strict
'
;
'
use strict
'
;
...
...
modules/facets_range_widget/tests/src/Functional/SliderIntegrationTest.php
View file @
984aff62
...
@@ -123,7 +123,7 @@ class SliderIntegrationTest extends FacetsTestBase {
...
@@ -123,7 +123,7 @@ class SliderIntegrationTest extends FacetsTestBase {
'type'
=>
'item'
,
'type'
=>
'item'
,
'keywords'
=>
[
'orange'
],
'keywords'
=>
[
'orange'
],
'category'
=>
'item_category'
,
'category'
=>
'item_category'
,
'field_integer'
=>
(
bool
)
$i
%
2
?
$i
:
$i
+
1
,
'field_integer'
=>
(
bool
)
$i
%
2
?
$i
:
$i
+
1
,
])
->
save
();
])
->
save
();
}
}
...
...
modules/facets_summary/src/FacetsSummaryManager/DefaultFacetsSummaryManager.php
View file @
984aff62
...
@@ -95,7 +95,7 @@ class DefaultFacetsSummaryManager {
...
@@ -95,7 +95,7 @@ class DefaultFacetsSummaryManager {
$facets_config
=
$facets_summary
->
getFacets
();
$facets_config
=
$facets_summary
->
getFacets
();
// Exclude facets which were not selected for this summary.
// Exclude facets which were not selected for this summary.
$facets
=
array_filter
(
$facets
,
$facets
=
array_filter
(
$facets
,
function
(
$item
)
use
(
$facets_config
)
{
function
(
$item
)
use
(
$facets_config
)
{
return
(
isset
(
$facets_config
[
$item
->
id
()]));
return
(
isset
(
$facets_config
[
$item
->
id
()]));
}
}
);
);
...
@@ -145,7 +145,7 @@ class DefaultFacetsSummaryManager {
...
@@ -145,7 +145,7 @@ class DefaultFacetsSummaryManager {
* @return array
* @return array
* The rendered links to the active facets.
* The rendered links to the active facets.
*/
*/
protected
function
buildResultTree
(
$show_count
,
$results
)
{
protected
function
buildResultTree
(
$show_count
,
array
$results
)
{
$items
=
[];
$items
=
[];
foreach
(
$results
as
$result
)
{
foreach
(
$results
as
$result
)
{
if
(
$result
->
isActive
())
{
if
(
$result
->
isActive
())
{
...
...
modules/facets_summary/src/Plugin/facets_summary/processor/ResetFacetsProcessor.php
View file @
984aff62
modules/facets_summary/tests/src/Functional/IntegrationTest.php
View file @
984aff62
...
@@ -5,7 +5,6 @@ namespace Drupal\Tests\facets_summary\Functional;
...
@@ -5,7 +5,6 @@ namespace Drupal\Tests\facets_summary\Functional;
use
Drupal\Tests\facets\Functional\FacetsTestBase
;
use
Drupal\Tests\facets\Functional\FacetsTestBase
;
use
Drupal\facets_summary
\
Entity\FacetsSummary
;
use
Drupal\facets_summary
\
Entity\FacetsSummary
;
use
Drupal\views\Views
;
use
Drupal\views\Views
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
/**
/**
* Tests the overall functionality of the Facets summary admin UI.
* Tests the overall functionality of the Facets summary admin UI.
...
...
src/Entity/FacetSource.php
View file @
984aff62
...
@@ -126,4 +126,5 @@ class FacetSource extends ConfigEntityBase implements FacetSourceInterface {
...
@@ -126,4 +126,5 @@ class FacetSource extends ConfigEntityBase implements FacetSourceInterface {
public
function
setBreadcrumbSettings
(
array
$settings
)
{
public
function
setBreadcrumbSettings
(
array
$settings
)
{
$this
->
breadcrumb
=
$settings
;
$this
->
breadcrumb
=
$settings
;
}
}
}
}
src/FacetListBuilder.php
View file @
984aff62
...
@@ -10,13 +10,11 @@ use Drupal\Component\Utility\Html;
...
@@ -10,13 +10,11 @@ use Drupal\Component\Utility\Html;
use
Drupal\facets_summary
\
Entity\FacetsSummary
;
use
Drupal\facets_summary
\
Entity\FacetsSummary
;
use
Drupal\facets_summary
\
FacetsSummaryInterface
;
use
Drupal\facets_summary
\
FacetsSummaryInterface
;
/**
/**
* Builds a listing of facet entities.
* Builds a listing of facet entities.
*/
*/
class
FacetListBuilder
extends
DraggableListBuilder
{
class
FacetListBuilder
extends
DraggableListBuilder
{
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
...
@@ -137,7 +135,7 @@ class FacetListBuilder extends DraggableListBuilder {
...
@@ -137,7 +135,7 @@ class FacetListBuilder extends DraggableListBuilder {
* Builds an array of facet summary for display in the overview.
* Builds an array of facet summary for display in the overview.
*/
*/
public
function
buildFacetSummaryRow
(
FacetsSummaryInterface
$entity
)
{
public
function
buildFacetSummaryRow
(
FacetsSummaryInterface
$entity
)
{
/** @var \Drupal\facets\FacetInterface $entity */
;
/** @var \Drupal\facets\FacetInterface $entity */
$facet
=
$entity
;
$facet
=
$entity
;
$row
=
parent
::
buildRow
(
$entity
);
$row
=
parent
::
buildRow
(
$entity
);
return
[
return
[
...
@@ -154,7 +152,7 @@ class FacetListBuilder extends DraggableListBuilder {
...
@@ -154,7 +152,7 @@ class FacetListBuilder extends DraggableListBuilder {
'#theme_wrappers'
=>
[
'#theme_wrappers'
=>
[
'container'
=>
[
'container'
=>
[
'#attributes'
=>
[
'class'
=>
'facets-title'
],
'#attributes'
=>
[
'class'
=>
'facets-title'
],
]
],
],
],
'#type'
=>
'link'
,
'#type'
=>
'link'
,
'#title'
=>
$facet
->
label
(),
'#title'
=>
$facet
->
label
(),
...
@@ -165,7 +163,7 @@ class FacetListBuilder extends DraggableListBuilder {
...
@@ -165,7 +163,7 @@ class FacetListBuilder extends DraggableListBuilder {
'colspan'
=>
2
,
'colspan'
=>
2
,
],
],
]
+
$facet
->
toUrl
(
'edit-form'
)
->
toRenderArray
(),
]
+
$facet
->
toUrl
(
'edit-form'
)
->
toRenderArray
(),
'oprations'
=>
$row
[
'operations'
],
'op
e
rations'
=>
$row
[
'operations'
],
'#attributes'
=>
[
'#attributes'
=>
[
'title'
=>
$this
->
t
(
'ID: @name'
,
[
'@name'
=>
$facet
->
id
()]),
'title'
=>
$this
->
t
(
'ID: @name'
,
[
'@name'
=>
$facet
->
id
()]),
'class'
=>
[
'class'
=>
[
...
@@ -193,7 +191,7 @@ class FacetListBuilder extends DraggableListBuilder {
...
@@ -193,7 +191,7 @@ class FacetListBuilder extends DraggableListBuilder {
'#theme_wrappers'
=>
[
'#theme_wrappers'
=>
[
'container'
=>
[
'container'
=>
[
'#attributes'
=>
[
'class'
=>
'facets-title'
],
'#attributes'
=>
[
'class'
=>
'facets-title'
],
]
]
,
],
],
'#type'
=>
'markup'
,
'#type'
=>
'markup'
,
'#markup'
=>
$facet_source
[
'id'
],
'#markup'
=>
$facet_source
[
'id'
],
...
@@ -263,7 +261,7 @@ class FacetListBuilder extends DraggableListBuilder {
...
@@ -263,7 +261,7 @@ class FacetListBuilder extends DraggableListBuilder {
$form
[
'facets'
][
$facet
->
id
()][
'weight'
][
'#attributes'
][
'class'
][]
=
$subgroup_class
;
$form
[
'facets'
][
$facet
->
id
()][
'weight'
][
'#attributes'
][
'class'
][]
=
$subgroup_class
;
$form
[
'facets'
][
$facet
->
id
()][
'weight'
][
'#delta'
]
=
$delta
;
$form
[
'facets'
][
$facet
->
id
()][
'weight'
][
'#delta'
]
=
$delta
;
}
}
elseif
(
$facet
instanceof
FacetsSummaryInterface
){
elseif
(
$facet
instanceof
FacetsSummaryInterface
)
{
$form
[
'facets'
][
$facet
->
id
()]
=
$this
->
buildFacetSummaryRow
(
$facet
);
$form
[
'facets'
][
$facet
->
id
()]
=
$this
->
buildFacetSummaryRow
(
$facet
);
}
}
}
}
...
@@ -373,4 +371,5 @@ class FacetListBuilder extends DraggableListBuilder {
...
@@ -373,4 +371,5 @@ class FacetListBuilder extends DraggableListBuilder {
'lone_facets'
=>
$facets
,
'lone_facets'
=>
$facets
,
];
];
}
}
}
}
src/FacetManager/DefaultFacetManager.php
View file @
984aff62
...
@@ -458,7 +458,7 @@ class DefaultFacetManager {
...
@@ -458,7 +458,7 @@ class DefaultFacetManager {
* @return \Drupal\facets\Result\ResultInterface[]
* @return \Drupal\facets\Result\ResultInterface[]
* A sorted array of results.
* A sorted array of results.
*/
*/
protected
function
sortFacetResults
(
array
$active_sort_processors
,
$results
)
{
protected
function
sortFacetResults
(
array
$active_sort_processors
,
array
$results
)
{
uasort
(
$results
,
function
(
$a
,
$b
)
use
(
$active_sort_processors
)
{
uasort
(
$results
,
function
(
$a
,
$b
)
use
(
$active_sort_processors
)
{
$return
=
0
;
$return
=
0
;
foreach
(
$active_sort_processors
as
$sort_processor
)
{
foreach
(
$active_sort_processors
as
$sort_processor
)
{
...
...
src/FacetSource/FacetSourcePluginInterface.php
View file @
984aff62
...
@@ -42,7 +42,8 @@ interface FacetSourcePluginInterface extends PluginFormInterface, DependentPlugi
...
@@ -42,7 +42,8 @@ interface FacetSourcePluginInterface extends PluginFormInterface, DependentPlugi
/**
/**
* Returns the path of the facet source, used to build the facet url.
* Returns the path of the facet source, used to build the facet url.
*
*
* @return string The path.
* @return string
* The path.
*/
*/
public
function
getPath
();
public
function
getPath
();
...
...
src/FacetSource/FacetSourcePluginManager.php
View file @
984aff62
...
@@ -58,7 +58,7 @@ class FacetSourcePluginManager extends DefaultPluginManager {
...
@@ -58,7 +58,7 @@ class FacetSourcePluginManager extends DefaultPluginManager {
// Definitions that are based on search api when search api is not enabled
// Definitions that are based on search api when search api is not enabled
// should not exist, so make sure we do exactly that, we do this in
// should not exist, so make sure we do exactly that, we do this in
// ::findDefinitions because this one is called before the result is saved.
// ::findDefinitions because this one is called before the result is saved.
$defs
=
array_filter
(
$defs
,
function
(
$item
)
{
$defs
=
array_filter
(
$defs
,
function
(
$item
)
{
if
(
$item
[
'id'
]
===
'search_api'
&&
!
$this
->
moduleHandler
->
moduleExists
(
'search_api'
))
{
if
(
$item
[
'id'
]
===
'search_api'
&&
!
$this
->
moduleHandler
->
moduleExists
(
'search_api'
))
{
return
FALSE
;
return
FALSE
;
}
}
...
...
src/FacetSource/SearchApiFacetSourceInterface.php
View file @
984aff62
...
@@ -15,7 +15,6 @@ interface SearchApiFacetSourceInterface extends FacetSourcePluginInterface {
...
@@ -15,7 +15,6 @@ interface SearchApiFacetSourceInterface extends FacetSourcePluginInterface {
*/
*/
public
function
getIndex
();
public
function
getIndex
();
/**
/**
* Retrieves the Search API display plugin associated with this facet source.
* Retrieves the Search API display plugin associated with this facet source.
*
*
...
@@ -23,4 +22,5 @@ interface SearchApiFacetSourceInterface extends FacetSourcePluginInterface {
...
@@ -23,4 +22,5 @@ interface SearchApiFacetSourceInterface extends FacetSourcePluginInterface {
* The Search API display plugin associated with this facet source.
* The Search API display plugin associated with this facet source.
*/
*/
public
function
getDisplay
();
public
function
getDisplay
();
}
}
src/Form/FacetCloneForm.php
View file @
984aff62
...
@@ -35,7 +35,17 @@ class FacetCloneForm extends EntityForm {
...
@@ -35,7 +35,17 @@ class FacetCloneForm extends EntityForm {
*/
*/
protected
$displayPluginManager
;
protected
$displayPluginManager
;
public
function
__construct
(
FacetSourcePluginManager
$facetSourcePluginManager
,
DisplayPluginManager
$displayPluginManager
,
EntityStorageInterface
$facetStorage
)
{
/**
* Creates the class.
*
* @param \Drupal\facets\FacetSource\FacetSourcePluginManager $facetSourcePluginManager
* The facet source plugin manager.
* @param \Drupal\search_api\Display\DisplayPluginManager $displayPluginManager
* Search api's display plugin manager.
* @param \Drupal\Core\Entity\EntityStorageInterface $facetStorage
* Entity storage class.
*/
public
function
__construct
(
FacetSourcePluginManager
$facetSourcePluginManager
,
DisplayPluginManager
$displayPluginManager
,
EntityStorageInterface
$facetStorage
)
{
$this
->
facetSourcePluginManager
=
$facetSourcePluginManager
;
$this
->
facetSourcePluginManager
=
$facetSourcePluginManager
;
$this
->
displayPluginManager
=
$displayPluginManager
;
$this
->
displayPluginManager
=
$displayPluginManager
;
$this
->
facetStorage
=
$facetStorage
;
$this
->
facetStorage
=
$facetStorage
;
...
...
src/Form/FacetSourceEditForm.php
View file @
984aff62
...
@@ -134,8 +134,8 @@ class FacetSourceEditForm extends EntityForm {
...
@@ -134,8 +134,8 @@ class FacetSourceEditForm extends EntityForm {
'#states'
=>
[
'#states'
=>
[
'visible'
=>
[
'visible'
=>
[
':input[name="breadcrumb[active]"]'
=>
[
'checked'
=>
TRUE
],
':input[name="breadcrumb[active]"]'
=>
[
'checked'
=>
TRUE
],
]
]
,
]
]
,
];
];
// The parent's form build method will add a save button.
// The parent's form build method will add a save button.
...
...
src/Plugin/facets/facet_source/SearchApiDisplay.php
View file @
984aff62
...
@@ -4,7 +4,6 @@ namespace Drupal\facets\Plugin\facets\facet_source;
...
@@ -4,7 +4,6 @@ namespace Drupal\facets\Plugin\facets\facet_source;
use
Drupal\Component\Plugin\DependentPluginInterface
;
use
Drupal\Component\Plugin\DependentPluginInterface
;
use
Drupal\Core\Form\FormStateInterface
;
use
Drupal\Core\Form\FormStateInterface
;
use
Drupal\Core\Url
;
use
Drupal\facets\Exception\InvalidQueryTypeException
;
use
Drupal\facets\Exception\InvalidQueryTypeException
;
use
Drupal\facets\FacetInterface
;
use
Drupal\facets\FacetInterface
;
use
Drupal\facets\FacetSource\FacetSourcePluginBase
;
use
Drupal\facets\FacetSource\FacetSourcePluginBase
;
...
...
tests/facets_custom_widget/src/Plugin/facets/processor/TestPreQuery.php
View file @
984aff62
...
@@ -28,14 +28,14 @@ class TestPreQuery extends ProcessorPluginBase implements PreQueryProcessorInter
...
@@ -28,14 +28,14 @@ class TestPreQuery extends ProcessorPluginBase implements PreQueryProcessorInter
return
[
return
[
'test_value'
=>
[
'test_value'
=>
[
'#type'
=>
'textfield'
,
'#type'
=>
'textfield'
,
]
]
,
];
];
}
}
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public
function
preQuery
(
\
Drupal\facets\
FacetInterface
$facet
)
{
public
function
preQuery
(
FacetInterface
$facet
)
{
drupal_set_message
(
$this
->
getConfiguration
()[
'test_value'
]);
drupal_set_message
(
$this
->
getConfiguration
()[
'test_value'
]);
}
}
...
...
tests/facets_query_processor/src/Plugin/facets/url_processor/DummyQuery.php
View file @
984aff62
...
@@ -17,6 +17,8 @@ class DummyQuery extends QueryString {
...
@@ -17,6 +17,8 @@ class DummyQuery extends QueryString {
/**
/**
* A string that separates the filters in the query string.
* A string that separates the filters in the query string.
*
* @var string
*/
*/
protected
$separator
=
'||'
;
protected
$separator
=
'||'
;
...
...
tests/src/Functional/BreadcrumbIntegrationTest.php
View file @
984aff62
...
@@ -79,7 +79,7 @@ class BreadcrumbIntegrationTest extends FacetsTestBase {
...
@@ -79,7 +79,7 @@ class BreadcrumbIntegrationTest extends FacetsTestBase {
* Edit the facet configuration with the given values.
* Edit the facet configuration with the given values.
*
*
* @param array $config
* @param array $config
* The new configuration for the facet
* The new configuration for the facet
.
*/
*/
public
function
editFacetConfig
(
array
$config
=
[])
{
public
function
editFacetConfig
(
array
$config
=
[])
{
$this
->
drupalGet
(
'admin/config/search/facets'
);
$this
->
drupalGet
(
'admin/config/search/facets'
);
...
@@ -98,8 +98,7 @@ class BreadcrumbIntegrationTest extends FacetsTestBase {
...
@@ -98,8 +98,7 @@ class BreadcrumbIntegrationTest extends FacetsTestBase {
* Tests Breadcrumb with the given config.
* Tests Breadcrumb with the given config.
*/
*/
protected
function
breadcrumbTest
()
{
protected
function
breadcrumbTest
()
{
// Breadcrumb should show Keywords: orange > Type: article, item
// Breadcrumb should show Keywords: orange > Type: article, item.
$initial_query
=
[
'search_api_fulltext'
=>
'foo'
,
'test_param'
=>
1
];
$initial_query
=
[
'search_api_fulltext'
=>
'foo'
,
'test_param'
=>
1
];
$this
->
drupalGet
(
'search-api-test-fulltext'
,
[
'query'
=>
$initial_query
]);
$this
->
drupalGet
(
'search-api-test-fulltext'
,
[
'query'
=>
$initial_query
]);
...
@@ -139,4 +138,5 @@ class BreadcrumbIntegrationTest extends FacetsTestBase {
...
@@ -139,4 +138,5 @@ class BreadcrumbIntegrationTest extends FacetsTestBase {
public
function
testNonGroupingIntegration
()
{
public
function
testNonGroupingIntegration
()
{
$this
->
markTestSkipped
(
'Not yet implemented.'
);
$this
->
markTestSkipped
(
'Not yet implemented.'
);
}
}
}
}
tests/src/Functional/FacetSourceTest.php
View file @
984aff62
...
@@ -107,4 +107,5 @@ class FacetSourceTest extends FacetsTestBase {
...
@@ -107,4 +107,5 @@ class FacetSourceTest extends FacetsTestBase {
$this
->
assertSession
()
->
checkboxChecked
(
'breadcrumb[group]'
);
$this
->
assertSession
()
->
checkboxChecked
(
'breadcrumb[group]'
);
$this
->
assertSession
()
->
checkboxChecked
(
'breadcrumb[active]'
);
$this
->
assertSession
()
->
checkboxChecked
(
'breadcrumb[active]'
);
}
}
}
}
tests/src/Unit/Plugin/processor/DependentFacetProcessorTest.php
View file @
984aff62
...
@@ -111,6 +111,7 @@ class DependentFacetProcessorTest extends UnitTestCase {
...
@@ -111,6 +111,7 @@ class DependentFacetProcessorTest extends UnitTestCase {
* Provides test cases with data.
* Provides test cases with data.
*
*
* @return array
* @return array
* An array of test data.
*/
*/
public
function
provideNegated
()
{
public
function
provideNegated
()
{
return
[
return
[
...
...
tests/src/Unit/Plugin/processor/TranslateEntityProcessorTest.php
View file @
984aff62
...
@@ -53,7 +53,7 @@ class TranslateEntityProcessorTest extends UnitTestCase {
...
@@ -53,7 +53,7 @@ class TranslateEntityProcessorTest extends UnitTestCase {
*
*
* @var \Drupal\facets\Result\ResultInterface[]
* @var \Drupal\facets\Result\ResultInterface[]
*/
*/
protected
$original
_r
esults
;
protected
$original
R
esults
;
/**
/**
* {@inheritdoc}
* {@inheritdoc}
...
@@ -109,8 +109,8 @@ class TranslateEntityProcessorTest extends UnitTestCase {
...
@@ -109,8 +109,8 @@ class TranslateEntityProcessorTest extends UnitTestCase {
->
method
(
'getFieldIdentifier'
)
->
method
(
'getFieldIdentifier'
)
->
willReturn
(
'testfield'
);
->
willReturn
(
'testfield'
);
$this
->
original
_r
esults
=
[
new
Result
(
2
,
2
,
5
)];
$this
->
original
R
esults
=
[
new
Result
(
2
,
2
,
5
)];
$this
->
facet
->
setResults
(
$this
->
original
_r
esults
);
$this
->
facet
->
setResults
(
$this
->
original
R
esults
);
// Mock language manager.
// Mock language manager.
$this
->
languageManager
=
$this
->
getMockBuilder
(
LanguageManagerInterface
::
class
)
$this
->
languageManager
=
$this
->
getMockBuilder
(
LanguageManagerInterface
::
class
)
...
@@ -163,14 +163,14 @@ class TranslateEntityProcessorTest extends UnitTestCase {
...
@@ -163,14 +163,14 @@ class TranslateEntityProcessorTest extends UnitTestCase {
// Without the processor we expect the id to display.
// Without the processor we expect the id to display.
foreach
(
$expected_results
as
$key
=>
$expected
)
{
foreach
(
$expected_results
as
$key
=>
$expected
)
{
$this
->
assertEquals
(
$expected
[
'nid'
],
$this
->
original
_r
esults
[
$key
]
->
getRawValue
());
$this
->
assertEquals
(
$expected
[
'nid'
],
$this
->
original
R
esults
[
$key
]
->
getRawValue
());
$this
->
assertEquals
(
$expected
[
'nid'
],
$this
->
original
_r
esults
[
$key
]
->
getDisplayValue
());
$this
->
assertEquals
(
$expected
[
'nid'
],
$this
->
original
R
esults
[
$key
]
->
getDisplayValue
());
}
}
// With the processor we expect the title to display.
// With the processor we expect the title to display.
/** @var \Drupal\facets\Result\ResultInterface[] $filtered_results */
/** @var \Drupal\facets\Result\ResultInterface[] $filtered_results */
$processor
=
new
TranslateEntityProcessor
([],
'translate_entity'
,
[],
$this
->
languageManager
,
$this
->
entityTypeManager
);
$processor
=
new
TranslateEntityProcessor
([],
'translate_entity'
,
[],
$this
->
languageManager
,
$this
->
entityTypeManager
);
$filtered_results
=
$processor
->
build
(
$this
->
facet
,
$this
->
original
_r
esults
);
$filtered_results
=
$processor
->
build
(
$this
->
facet
,
$this
->
original
R
esults
);
foreach
(
$expected_results
as
$key
=>
$expected
)
{
foreach
(
$expected_results
as
$key
=>
$expected
)
{
$this
->
assertEquals
(
$expected
[
'nid'
],
$filtered_results
[
$key
]
->
getRawValue
());
$this
->
assertEquals
(
$expected
[
'nid'
],
$filtered_results
[
$key
]
->
getRawValue
());
$this
->
assertEquals
(
$expected
[
'title'
],
$filtered_results
[
$key
]
->
getDisplayValue
());
$this
->
assertEquals
(
$expected
[
'title'
],
$filtered_results
[
$key
]
->
getDisplayValue
());
...
@@ -206,13 +206,13 @@ class TranslateEntityProcessorTest extends UnitTestCase {
...
@@ -206,13 +206,13 @@ class TranslateEntityProcessorTest extends UnitTestCase {
// Without the processor we expect the id to display.
// Without the processor we expect the id to display.
foreach
(
$expected_results
as
$key
=>
$expected
)
{
foreach
(
$expected_results
as
$key
=>
$expected
)
{
$this
->
assertEquals
(
$expected
[
'tid'
],
$this
->
original
_r
esults
[
$key
]
->
getRawValue
());
$this
->
assertEquals
(
$expected
[
'tid'
],
$this
->
original
R
esults
[
$key
]
->
getRawValue
());
$this
->
assertEquals
(
$expected
[
'tid'
],
$this
->
original
_r
esults
[
$key
]
->
getDisplayValue
());
$this
->
assertEquals
(
$expected
[
'tid'
],
$this
->
original
R
esults
[
$key
]
->
getDisplayValue
());
}
}
/** @var \Drupal\facets\Result\ResultInterface[] $filtered_results */
/** @var \Drupal\facets\Result\ResultInterface[] $filtered_results */
$processor
=
new
TranslateEntityProcessor
([],
'translate_entity'
,
[],
$this
->
languageManager
,
$this
->
entityTypeManager
);
$processor
=
new
TranslateEntityProcessor
([],
'translate_entity'
,
[],
$this
->
languageManager
,
$this
->
entityTypeManager
);
$filtered_results
=
$processor
->
build
(
$this
->
facet
,
$this
->
original
_r
esults
);
$filtered_results
=
$processor
->
build
(
$this
->
facet
,
$this
->
original
R
esults
);
// With the processor we expect the title to display.
// With the processor we expect the title to display.
foreach
(
$expected_results
as
$key
=>
$expected
)
{
foreach
(
$expected_results
as
$key
=>
$expected
)
{
...
@@ -226,7 +226,6 @@ class TranslateEntityProcessorTest extends UnitTestCase {
...
@@ -226,7 +226,6 @@ class TranslateEntityProcessorTest extends UnitTestCase {
*/
*/
public
function
testDeletedEntityResults
()
{
public
function
testDeletedEntityResults
()
{
// Set original results.
// Set original results.
$term_storage
=
$this
->
getMock
(
EntityStorageInterface
::
class
);
$term_storage
=
$this
->
getMock
(
EntityStorageInterface
::
class
);
$term_storage
->
expects
(
$this
->
any
())
$term_storage
->
expects
(
$this
->
any
())
->
method
(
'loadMultiple'
)
->
method
(
'loadMultiple'
)
...
@@ -238,7 +237,7 @@ class TranslateEntityProcessorTest extends UnitTestCase {
...
@@ -238,7 +237,7 @@ class TranslateEntityProcessorTest extends UnitTestCase {
// Processor should return nothing (and not throw an exception).
// Processor should return nothing (and not throw an exception).
/** @var \Drupal\facets\Result\ResultInterface[] $filtered_results */
/** @var \Drupal\facets\Result\ResultInterface[] $filtered_results */
$processor
=
new
TranslateEntityProcessor
([],
'translate_entity'
,
[],
$this
->
languageManager
,
$this
->
entityTypeManager
);
$processor
=
new
TranslateEntityProcessor
([],
'translate_entity'
,
[],
$this
->
languageManager
,
$this
->
entityTypeManager
);
$filtered_results
=
$processor
->
build
(
$this
->
facet
,
$this
->
original
_r
esults
);
$filtered_results
=
$processor
->
build
(
$this
->
facet
,
$this
->
original
R
esults
);
$this
->
assertEmpty
(
$filtered_results
);
$this
->
assertEmpty
(
$filtered_results
);
}
}
...
...
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