function TourTest::findTip

Same name and namespace in other branches
  1. 10 core/modules/tour/tests/src/Functional/TourTest.php \Drupal\Tests\tour\Functional\TourTest::findTip()
  2. 11.x core/modules/tour/tests/src/Functional/TourTest.php \Drupal\Tests\tour\Functional\TourTest::findTip()

Find specific tips by their parameters in the list of tips.

Parameters

array $params: The list of search parameters and their values.

Return value

array A list of tips which match the parameters.

1 call to TourTest::findTip()
TourTest::testTourFunctionality in core/modules/tour/tests/src/Functional/TourTest.php
Tests tour functionality.

File

core/modules/tour/tests/src/Functional/TourTest.php, line 264

Class

TourTest
Tests the functionality of tour tips.

Namespace

Drupal\Tests\tour\Functional

Code

protected function findTip(array $params) {
    $tips = $this->getTourTips();
    $elements = [];
    foreach ($tips as $tip) {
        foreach ($params as $param => $value) {
            if (isset($tip[$param]) && $tip[$param] != $value) {
                continue 2;
            }
        }
        $elements[] = $tip;
    }
    return $elements;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.