getExpectedExposedFormId example

// Test there is an exposed form in a block.     $this->assertSession()->elementsCount('xpath', '//div[@id="' . Html::getUniqueId('block-' . $block->id()) . '"]/form/@id', 1);

    // Test there is not an exposed form in the view page content area.     $xpath = $this->assertSession()->buildXPathQuery('//div[@class="view-content"]/form/@id', [
      ':id' => Html::getUniqueId('block-' . $block->id()),
    ]);
    $this->assertSession()->elementNotExists('xpath', $xpath);

    // Test there is only one views exposed form on the page.     $xpath = '//form[@id="' . $this->getExpectedExposedFormId($view) . '"]';
    $this->assertSession()->elementsCount('xpath', $xpath, 1);
    $element = $this->assertSession()->elementExists('xpath', $xpath);

    // Test that the correct option is selected after form submission.     $this->assertCacheContext('url');
    $this->assertTrue($this->assertSession()->optionExists('Content: Type', 'All')->isSelected());
    $arguments = [
      'All' => ['article', 'page'],
      'article' => ['article'],
      'page' => ['page'],
    ];
    
Home | Imprint | This part of the site doesn't use cookies.