function LayoutBuilderAccessTest::assertExpectedAccess

Same name in other branches
  1. 9 core/modules/layout_builder/tests/src/Functional/LayoutBuilderAccessTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderAccessTest::assertExpectedAccess()
  2. 8.9.x core/modules/layout_builder/tests/src/Functional/LayoutBuilderAccessTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderAccessTest::assertExpectedAccess()
  3. 10 core/modules/layout_builder/tests/src/Functional/LayoutBuilderAccessTest.php \Drupal\Tests\layout_builder\Functional\LayoutBuilderAccessTest::assertExpectedAccess()

Asserts the correct response code is returned based on expected access.

Parameters

bool $expected_access: The expected access.

2 calls to LayoutBuilderAccessTest::assertExpectedAccess()
LayoutBuilderAccessTest::testAccessWithBundles in core/modules/layout_builder/tests/src/Functional/LayoutBuilderAccessTest.php
Tests Layout Builder access for an entity type that has bundles.
LayoutBuilderAccessTest::testAccessWithoutBundles in core/modules/layout_builder/tests/src/Functional/LayoutBuilderAccessTest.php
Tests Layout Builder access for an entity type that does not have bundles.

File

core/modules/layout_builder/tests/src/Functional/LayoutBuilderAccessTest.php, line 285

Class

LayoutBuilderAccessTest
Tests access to Layout Builder.

Namespace

Drupal\Tests\layout_builder\Functional

Code

private function assertExpectedAccess(bool $expected_access) : void {
    $expected_status_code = $expected_access ? 200 : 403;
    $this->assertSession()
        ->statusCodeEquals($expected_status_code);
}

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