LocalActionTest.php

Same filename in this branch
  1. 11.x core/modules/system/tests/src/Functional/Menu/LocalActionTest.php
  2. 11.x core/modules/system/tests/modules/menu_test/src/Plugin/Derivative/LocalActionTest.php
Same filename in other branches
  1. 9 core/modules/system/tests/src/Functional/Menu/LocalActionTest.php
  2. 9 core/modules/system/tests/modules/menu_test/src/Plugin/Derivative/LocalActionTest.php
  3. 8.9.x core/modules/system/tests/src/Functional/Menu/LocalActionTest.php
  4. 8.9.x core/modules/system/tests/modules/menu_test/src/Plugin/Derivative/LocalActionTest.php
  5. 10 core/modules/system/tests/src/Functional/Menu/LocalActionTest.php
  6. 10 core/modules/system/tests/modules/menu_test/src/Plugin/Derivative/LocalActionTest.php

Namespace

Drupal\Tests\block_content\Functional

File

core/modules/block_content/tests/src/Functional/LocalActionTest.php

View source
<?php

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


/**
 * Tests block_content local action links.
 *
 * @group block_content
 */
class LocalActionTest extends BlockContentTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected $defaultTheme = 'stark';
    
    /**
     * {@inheritdoc}
     */
    protected function setUp() : void {
        parent::setUp();
        $this->drupalLogin($this->adminUser);
    }
    
    /**
     * Tests the block_content_add_action link.
     */
    public function testAddContentBlockLink() : void {
        // Verify that the link takes you straight to the block form if there's only
        // one type.
        $this->drupalGet('/admin/content/block');
        $this->clickLink('Add content block');
        $this->assertSession()
            ->statusCodeEquals(200);
        $this->assertSession()
            ->addressEquals('/block/add/basic');
        $type = $this->randomMachineName();
        $this->createBlockContentType([
            'id' => $type,
            'label' => $type,
        ]);
        // Verify that the link takes you to the block add page if there's more than
        // one type.
        $this->drupalGet('/admin/content/block');
        $this->clickLink('Add content block');
        $this->assertSession()
            ->statusCodeEquals(200);
        $this->assertSession()
            ->addressEquals('/block/add');
    }

}

Classes

Title Deprecated Summary
LocalActionTest Tests block_content local action links.

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