You are here

public function SimpleWidgetTest::testEntityWithoutBundle in Inline Entity Form 8

Ensures that an entity without bundles can be used with the simple widget.

File

tests/src/FunctionalJavascript/SimpleWidgetTest.php, line 215

Class

SimpleWidgetTest
Tests the IEF simple widget.

Namespace

Drupal\Tests\inline_entity_form\FunctionalJavascript

Code

public function testEntityWithoutBundle() {

  // Get the xpath selectors for the fields in this test.
  $title_field_xpath = $this
    ->getXpathForNthInputByLabelText('Title', 1);
  $name_field_xpath = $this
    ->getXpathForNthInputByLabelText('Name', 1);
  $assert_session = $this
    ->assertSession();
  $page = $this
    ->getSession()
    ->getPage();
  $this
    ->drupalLogin($this->user);
  $this
    ->drupalGet('node/add/ief_simple_entity_no_bundle');
  $assert_session
    ->elementExists('xpath', $title_field_xpath)
    ->setValue('Node title');
  $assert_session
    ->elementExists('xpath', $name_field_xpath)
    ->setValue('Entity title');
  $page
    ->pressButton('Save');
  $assert_session
    ->pageTextContains('IEF simple entity no bundle Node title has been created.');
  $this
    ->assertNodeByTitle('Node title', 'ief_simple_entity_no_bundle');
  $this
    ->assertEntityByLabel('Entity title', 'entity_test__without_bundle');
}