Skip to content

Commit

Permalink
OEL-2782: Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
brummbar committed Dec 21, 2023
1 parent 8f8b2dd commit d6af188
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 10 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@
"dealerdirect/phpcodesniffer-composer-installer": true,
"drupal/core-composer-scaffold": true,
"phpro/grumphp": true,
"phpstan/extension-installer": true
"phpstan/extension-installer": true,
"php-http/discovery": false
},
"github-oauth": {

Expand Down
7 changes: 7 additions & 0 deletions src/ListBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ class ListBuilder implements ListBuilderInterface {
*/
protected $entityRepository;

/**
* The facet manager wrapper.
*
* @var \Drupal\oe_list_pages\ListFacetManagerWrapper
*/
protected ListFacetManagerWrapper $facetManager;

/**
* The form builder.
*
Expand Down
8 changes: 8 additions & 0 deletions src/MultiselectFilterFieldPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Drupal\Component\Utility\SortArray;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
use Drupal\facets\FacetInterface;
Expand All @@ -18,6 +19,13 @@ class MultiselectFilterFieldPluginManager extends DefaultPluginManager {

use FacetManipulationTrait;

/**
* The entity field manager.
*
* @var \Drupal\Core\Entity\EntityFieldManagerInterface
*/
protected EntityFieldManagerInterface $entityFieldManager;

/**
* Constructs a new multiselect filter field plugin manager.
*
Expand Down
4 changes: 2 additions & 2 deletions tests/src/FunctionalJavascript/ListPagePluginFormTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function assertListPagePresetFilterValidations(string $default_value_name
$this->assertDefaultValueForFilters([
[
'key' => '',
'value' => t('No default values set'),
'value' => 'No default values set',
],
]);

Expand Down Expand Up @@ -390,7 +390,7 @@ public function assertListPagePresetFilters(string $default_value_name_prefix, s
$this->assertDefaultValueForFilters([
[
'key' => '',
'value' => t('No default values set'),
'value' => 'No default values set',
],
]);
// Set a preset filter for Select two.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public function testCustomFieldWithDefaultStatus(): void {
$this->assertSession()->assertWaitOnAjaxRequest();
$filter_id = DefaultFilterConfigurationBuilder::generateFilterId($facet->id());
$filter_selector = 'emr_plugins_oe_list_page[wrapper][default_filter_values][wrapper][edit][' . $filter_id . ']';
$this->getSession()->getPage()->selectFieldOption($filter_selector . '[' . $facet->id() . '][0][list]', 2);
$this->getSession()->getPage()->selectFieldOption($filter_selector . '[' . $facet->id() . '][0][list]', '2');
$this->getSession()->getPage()->pressButton('Set default value');
$this->assertSession()->assertWaitOnAjaxRequest();
$this->getSession()->getPage()->pressButton('Save');
Expand Down
6 changes: 3 additions & 3 deletions tests/src/Kernel/ListBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ class ListBuilderTest extends ListsSourceTestBase {
*/
public function testFacetCacheTags(): void {
$default_list_id = ListSourceFactory::generateFacetSourcePluginId('entity_test_mulrev_changed', 'item');
$this->facet = $this->createFacet('created', $default_list_id, '', 'oe_list_pages_multiselect', []);
$this->facet->addProcessor([
$facet = $this->createFacet('created', $default_list_id, '', 'oe_list_pages_multiselect', []);
$facet->addProcessor([
'processor_id' => 'oe_list_pages_date_status_processor',
'weights' => [],
'settings' => [],
]);
$this->facet->save();
$facet->save();

$configuration = [
'entity_type' => 'entity_test_mulrev_changed',
Expand Down
6 changes: 3 additions & 3 deletions tests/src/Kernel/ListFacetsFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ class ListFacetsFormTest extends ListsSourceTestBase {
*/
public function testFacetCacheTags(): void {
$default_list_id = ListSourceFactory::generateFacetSourcePluginId('entity_test_mulrev_changed', 'item');
$this->facet = $this->createFacet('created', $default_list_id, '', 'oe_list_pages_multiselect', []);
$this->facet->addProcessor([
$facet = $this->createFacet('created', $default_list_id, '', 'oe_list_pages_multiselect', []);
$facet->addProcessor([
'processor_id' => 'oe_list_pages_date_status_processor',
'weights' => [],
'settings' => [],
]);

$this->facet->save();
$facet->save();

$list = $this->listFactory->get('entity_test_mulrev_changed', 'item');

Expand Down

0 comments on commit d6af188

Please sign in to comment.