You are here

public function ComplexWidgetTest::testComplexEntityCreate in Inline Entity Form 8

Tests create access on IEF Complex content type.

File

tests/src/FunctionalJavascript/ComplexWidgetTest.php, line 839

Class

ComplexWidgetTest
IEF complex field widget tests.

Namespace

Drupal\Tests\inline_entity_form\FunctionalJavascript

Code

public function testComplexEntityCreate() {

  // Get the xpath selectors for the input fields in this test.
  $nested_title_field_xpath = $this
    ->getXpathForNthInputByLabelText('Title', 2);
  $user = $this
    ->createUser([
    'create ief_test_complex content',
  ]);
  $this
    ->drupalLogin($user);
  $this
    ->drupalGet('node/add/ief_test_complex');
  $assert_session = $this
    ->assertSession();
  $assert_session
    ->fieldNotExists('all_bundles[actions][bundle]');
  $assert_session
    ->elementNotExists('xpath', $nested_title_field_xpath);
  $user = $this
    ->createUser([
    'create ief_test_complex content',
    'create ief_reference_type content',
  ]);
  $this
    ->drupalLogin($user);
  $this
    ->drupalGet('node/add/ief_test_complex');
  $assert_session
    ->fieldExists('all_bundles[actions][bundle]');
  $this
    ->assertSession()
    ->optionExists('edit-all-bundles-actions-bundle', 'ief_reference_type');
  $this
    ->assertSession()
    ->optionExists('edit-all-bundles-actions-bundle', 'ief_test_complex');
  $assert_session
    ->elementExists('xpath', $nested_title_field_xpath);
}