You are here

protected function WidgetTestBase::buildLinkAssertion in Facets 8

Build a formattable markup object to use as assertion.

Parameters

string $text: Text to display.

string $raw_value: Raw value of the result.

\Drupal\facets\FacetInterface $facet: The facet.

int $count: Number of results.

bool $active: Link is active.

bool $show_numbers: Numbers are displayed.

Return value

array A render array.

6 calls to WidgetTestBase::buildLinkAssertion()
CheckboxWidgetTest::testNoFilterResults in tests/src/Unit/Plugin/widget/CheckboxWidgetTest.php
Tests widget without filters.
DropdownWidgetTest::testNoFilterResults in tests/src/Unit/Plugin/widget/DropdownWidgetTest.php
Tests widget without filters.
LinksWidgetTest::testActiveItems in tests/src/Unit/Plugin/widget/LinksWidgetTest.php
Test widget with 2 active items.
LinksWidgetTest::testChildren in tests/src/Unit/Plugin/widget/LinksWidgetTest.php
Tests for links widget with children.
LinksWidgetTest::testHideNumbers in tests/src/Unit/Plugin/widget/LinksWidgetTest.php
Tests widget, make sure hiding and showing numbers works.

... See full list

File

tests/src/Unit/Plugin/widget/WidgetTestBase.php, line 130

Class

WidgetTestBase
Base class for widget unit tests.

Namespace

Drupal\Tests\facets\Unit\Plugin\widget

Code

protected function buildLinkAssertion($text, $raw_value, FacetInterface $facet, $count = 0, $active = FALSE, $show_numbers = TRUE) {
  return [
    '#theme' => 'facets_result_item',
    '#raw_value' => $raw_value,
    '#facet' => $facet,
    '#value' => $text,
    '#show_count' => $show_numbers && $count !== NULL,
    '#count' => $count,
    '#is_active' => $active,
  ];
}