BlockContentRedirectTest.php

Same filename and directory in other branches
  1. 10 core/modules/block_content/tests/src/Functional/BlockContentRedirectTest.php
  2. 11.x core/modules/block_content/tests/src/Functional/Views/BlockContentRedirectTest.php
  3. 10 core/modules/block_content/tests/src/Functional/Views/BlockContentRedirectTest.php
  4. 9 core/modules/block_content/tests/src/Functional/Views/BlockContentRedirectTest.php
  5. 8.9.x core/modules/block_content/tests/src/Functional/Views/BlockContentRedirectTest.php

Namespace

Drupal\Tests\block_content\Functional\Views

File

core/modules/block_content/tests/src/Functional/Views/BlockContentRedirectTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\block_content\Functional\Views;

use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;

/**
 * Tests the redirect destination on block content on entity operations.
 */
class BlockContentRedirectTest extends BlockContentTestBase {
  
  /**
   * Views used by this test.
   *
   * @var array
   */
  public static $testViews = [
    'test_block_content_redirect_destination',
  ];
  
  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'block',
    'block_content',
    'views',
  ];
  
  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';
  
  /**
   * Tests the redirect destination when editing block content.
   */
  public function testRedirectDestination() : void {
    $this->drupalLogin($this->drupalCreateUser([
      'access block library',
      'administer block content',
    ]));
    // Create a content block.
    $block = $this->createBlockContent();
    // Check the block content is present in the view redirect destination.
    $this->drupalGet('admin/content/redirect_destination');
    $this->assertSession()
      ->pageTextContains($block->label());
    // Edit the created block and save.
    $this->clickLink('Edit');
    $this->submitForm([], 'Save');
    $this->assertSession()
      ->addressEquals('admin/content/redirect_destination');
  }

}

Classes

Title Deprecated Summary
BlockContentRedirectTest Tests the redirect destination on block content on entity operations.

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