You are here

protected function CancelButtonEntityRoutesTest::setUp in Entity Form Cancel Button 8

Overrides BrowserTestBase::setUp

File

tests/src/Functional/CancelButtonEntityRoutesTest.php, line 35

Class

CancelButtonEntityRoutesTest
Tests cancel button functionality under various entity route conditions.

Namespace

Drupal\Tests\cancel_button\Functional

Code

protected function setUp() {
  parent::setUp();
  foreach ([
    'entity_test_broken_canonical',
    'entity_test_broken_collection',
  ] as $entity_type) {
    $storage = $this->container
      ->get('entity_type.manager')
      ->getStorage($entity_type);

    // Create some dummy entity_test_missing_routes entities.
    $entity_test = $storage
      ->create([
      'name' => $this
        ->randomMachineName(),
    ]);
    $entity_test
      ->save();
    $this->entities[] = $entity_test;
  }
  $permissions = [
    'administer cancel button configuration',
    'administer entity_test content',
    'view test entity',
  ];
  $this
    ->drupalLogin($this
    ->drupalCreateUser($permissions));
}