Commit 5cede43c authored by borisson_'s avatar borisson_

PHPCS: Code style fixes

parent a4a836e9
......@@ -41,10 +41,9 @@ class SearchApiViewsDeriver extends FacetSourceDeriverBase {
$displays = $view->get('display');
foreach ($displays as $display_id => $display_info) {
// We only support pages and blocks because those are the ones that
// we've tested. They are also the only ones that support for
// ::isRenderedInCurrentRequest() and ::getPath().
if (in_array($display_info['display_plugin'], ['page', 'block', 'rest_export'])) {
// We only support page, block and REST export displays for views.
$allowed_plugins = ['page', 'block', 'rest_export'];
if (in_array($display_info['display_plugin'], $allowed_plugins)) {
$machine_name = $view->id() . PluginBase::DERIVATIVE_SEPARATOR . $display_id;
$label_arguments = [
......
......@@ -85,7 +85,7 @@ class FacetsSerializer extends Serializer {
$this->facetsManager->updateResults($facetsource_id);
$processed_facets = [];
foreach($facets as $facet) {
foreach ($facets as $facet) {
$processed_facets[] = $this->facetsManager->build($facet);
}
......
......@@ -35,7 +35,7 @@ class RestIntegrationTest extends WebTestBase {
$id = 'type';
// Add a new facet to filter by content type.
$this->createFacet($name, $id, 'type','rest_export_1');
$this->createFacet($name, $id, 'type', 'rest_export_1');
// Use the array widget.
$facet_edit_page = '/admin/config/search/facets/' . $id . '/edit';
......@@ -58,7 +58,7 @@ class RestIntegrationTest extends WebTestBase {
$name = 'Keywords';
$id = 'keywords';
// Add a new facet to filter by keywords.
$this->createFacet($name, $id, 'keywords','rest_export_1');
$this->createFacet($name, $id, 'keywords', 'rest_export_1');
// Use the array widget.
$facet_edit_page = '/admin/config/search/facets/' . $id . '/edit';
......@@ -86,15 +86,15 @@ class RestIntegrationTest extends WebTestBase {
$results = [
'article' => [
'url' => $base_url . '/facets-rest?f[0]=type%3Aarticle',
'count' => 2
'count' => 2,
],
'item' => [
'url' => $base_url . '/facets-rest?f[0]=type%3Aitem',
'count' => 3
'count' => 3,
],
];
foreach($json_decoded->facets[1][0]->type as $result) {
foreach ($json_decoded->facets[1][0]->type as $result) {
$value = $result->values->value;
$this->assertEqual($result->url, $results[$value]['url']);
$this->assertEqual($result->values->count, $results[$value]['count']);
......@@ -104,27 +104,27 @@ class RestIntegrationTest extends WebTestBase {
$results = [
'banana' => [
'url' => $base_url . '/facets-rest?f[0]=keywords%3Abanana',
'count' => 1
'count' => 1,
],
'strawberry' => [
'url' => $base_url . '/facets-rest?f[0]=keywords%3Astrawberry',
'count' => 2
'count' => 2,
],
'apple' => [
'url' => $base_url . '/facets-rest?f[0]=keywords%3Aapple',
'count' => 2
'count' => 2,
],
'orange' => [
'url' => $base_url . '/facets-rest?f[0]=keywords%3Aorange',
'count' => 3
'count' => 3,
],
'grape' => [
'url' => $base_url . '/facets-rest?f[0]=keywords%3Agrape',
'count' => 3
'count' => 3,
],
];
foreach($json_decoded->facets[0][0]->keywords as $result) {
foreach ($json_decoded->facets[0][0]->keywords as $result) {
$value = $result->values->value;
$this->assertEqual($result->url, $results[$value]['url']);
$this->assertEqual($result->values->count, $results[$value]['count']);
......@@ -139,41 +139,41 @@ class RestIntegrationTest extends WebTestBase {
$results = [
'article' => [
'url' => $base_url . '/facets-rest?f[0]=type%3Aitem&f[1]=type%3Aarticle',
'count' => 2
'count' => 2,
],
'item' => [
'url' => $base_url . '/facets-rest',
'count' => 3
'count' => 3,
],
'banana' => [
'url' => $base_url . '/facets-rest?f[0]=type%3Aitem&f[1]=keywords%3Abanana',
'count' => 0
'count' => 0,
],
'strawberry' => [
'url' => $base_url . '/facets-rest?f[0]=type%3Aitem&f[1]=keywords%3Astrawberry',
'count' => 0
'count' => 0,
],
'apple' => [
'url' => $base_url . '/facets-rest?f[0]=type%3Aitem&f[1]=keywords%3Aapple',
'count' => 1
'count' => 1,
],
'orange' => [
'url' => $base_url . '/facets-rest?f[0]=type%3Aitem&f[1]=keywords%3Aorange',
'count' => 2
'count' => 2,
],
'grape' => [
'url' => $base_url . '/facets-rest?f[0]=type%3Aitem&f[1]=keywords%3Agrape',
'count' => 1
'count' => 1,
],
];
foreach($json_decoded->facets[1][0]->type as $result) {
foreach ($json_decoded->facets[1][0]->type as $result) {
$value = $result->values->value;
$this->assertEqual($result->url, $results[$value]['url']);
$this->assertEqual($result->values->count, $results[$value]['count']);
}
foreach($json_decoded->facets[0][0]->keywords as $result) {
foreach ($json_decoded->facets[0][0]->keywords as $result) {
$value = $result->values->value;
$this->assertEqual($result->url, $results[$value]['url']);
$this->assertEqual($result->values->count, $results[$value]['count']);
......
......@@ -2,7 +2,6 @@
namespace Drupal\facets\Widget;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Link;
......
......@@ -22,7 +22,7 @@ class ArrayWidgetTest extends UnitTestCase {
/**
* The processor to be tested.
*
* @var \Drupal\facets\Widget\WidgetInterface
* @var \Drupal\facets\Widget\WidgetPluginInterface
*/
protected $widget;
......@@ -52,7 +52,6 @@ class ArrayWidgetTest extends UnitTestCase {
}
$this->originalResults = $original_results;
// Creates a mocked container, so we can access string translation.
$container = $this->prophesize(ContainerInterface::class);
$string_translation = $this->prophesize(TranslationInterface::class);
......
......@@ -2,7 +2,6 @@
namespace Drupal\Tests\facets\Unit\Plugin\widget;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Url;
use Drupal\facets\Entity\Facet;
use Drupal\facets\Plugin\facets\widget\CheckboxWidget;
......
......@@ -2,7 +2,6 @@
namespace Drupal\Tests\facets\Unit\Plugin\widget;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\Core\Url;
use Drupal\facets\Entity\Facet;
......
......@@ -2,7 +2,6 @@
namespace Drupal\Tests\facets\Unit\Plugin\widget;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Url;
use Drupal\facets\Entity\Facet;
use Drupal\facets\Plugin\facets\widget\LinksWidget;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment