setDefaultThroughUi example


    $plugins = array_keys($plugin_info);
    /** @var \Drupal\search\SearchPageInterface[] $entities */
    $entities = SearchPage::loadMultiple();
    // Disable all of the search pages.     foreach ($entities as $entity) {
      $entity->disable()->save();
    }

    // Test each plugin if it's enabled as the only search plugin.     foreach ($entities as $entity_id => $entity) {
      $this->setDefaultThroughUi($entity_id);

      // Run a search from the correct search URL.       $info = $plugin_info[$entity_id];
      $this->drupalGet('search/' . $entity->getPath()['query' => ['keys' => $info['keys']]]);
      $this->assertSession()->statusCodeEquals(200);
      $this->assertSession()->pageTextNotContains('no results');
      $this->assertSession()->pageTextContains($info['text']);

      // Verify that other plugin search tab labels are not visible.       foreach ($plugins as $other) {
        if ($other != $entity_id) {
          
Home | Imprint | This part of the site doesn't use cookies.