You are here

public function FormModeManagerRouteTest::testListWithOneFormModeManagerRoutes in Form mode manager 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/FormModeManagerRouteTest.php \Drupal\Tests\form_mode_manager\Functional\FormModeManagerRouteTest::testListWithOneFormModeManagerRoutes()

Asserts List With One Form Mode Manager routes exists.

File

tests/src/Functional/FormModeManagerRouteTest.php, line 187

Class

FormModeManagerRouteTest
Tests the routes generated by form_mode_manager.

Namespace

Drupal\Tests\form_mode_manager\Functional

Code

public function testListWithOneFormModeManagerRoutes() {
  $this
    ->drupalLogin($this->adminUser);
  $node_form_mode_id = $this->formModeManager
    ->getFormModeMachineName($this->nodeFormMode
    ->id());
  $this
    ->drupalGet("node/add-list/{$node_form_mode_id}");
  $this
    ->assertSession()
    ->titleEquals("Create {$this->nodeTypeFmm1->label()} as {$this->nodeFormMode->label()} | Drupal");
  $this
    ->assertSession()
    ->statusCodeEquals(200);

  // List form mode for anonymous.
  $this
    ->drupalLogin($this->anonymousUser);
  $this
    ->drupalGet("node/add-list/{$node_form_mode_id}");
  $this
    ->assertSession()
    ->statusCodeEquals(403);

  // List form mode not exit.
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet("node/add-list/not-valid-fm");
  $this
    ->assertSession()
    ->statusCodeEquals(404);
}