clearDefaultSearchPage example

$config = $this->getMockBuilder('Drupal\Core\Config\Config')
      ->disableOriginalConstructor()
      ->getMock();
    $config->expects($this->once())
      ->method('clear')
      ->with('default_page')
      ->willReturn($config);
    $this->configFactory->expects($this->once())
      ->method('getEditable')
      ->with('search.settings')
      ->willReturn($config);
    $this->searchPageRepository->clearDefaultSearchPage();
  }

  /** * Tests the getDefaultSearchPage() method when the default is active. */
  public function testGetDefaultSearchPageWithActiveDefault() {
    $this->query->expects($this->once())
      ->method('condition')
      ->with('status', TRUE)
      ->willReturn($this->query);
    $this->query->expects($this->once())
      
$this->routeBuilder()->setRebuildNeeded();
  }

  /** * {@inheritdoc} */
  public static function postDelete(EntityStorageInterface $storage, array $entities) {
    parent::postDelete($storage$entities);

    $search_page_repository = \Drupal::service('search.search_page_repository');
    if (!$search_page_repository->isSearchActive()) {
      $search_page_repository->clearDefaultSearchPage();
    }
  }

  /** * {@inheritdoc} */
  public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b) {
    /** @var \Drupal\search\SearchPageInterface $a */
    /** @var \Drupal\search\SearchPageInterface $b */
    $a_status = (int) $a->status();
    $b_status = (int) $b->status();
    
Home | Imprint | This part of the site doesn't use cookies.