You are here

protected function InlineEntityFormTestBase::assertNodeByTitle in Inline Entity Form 8

Passes if a node is found for the title.

Parameters

string $title: Node title to check.

string $content_type: The content type to check.

string $message: Message to display.

2 calls to InlineEntityFormTestBase::assertNodeByTitle()
ElementWebTest::testCustomForm in tests/src/FunctionalJavascript/ElementWebTest.php
Tests IEF on a custom form.
SimpleWidgetTest::testEntityWithoutBundle in tests/src/FunctionalJavascript/SimpleWidgetTest.php
Ensures that an entity without bundles can be used with the simple widget.

File

tests/src/FunctionalJavascript/InlineEntityFormTestBase.php, line 109

Class

InlineEntityFormTestBase
Base Class for Inline Entity Form Tests.

Namespace

Drupal\Tests\inline_entity_form\FunctionalJavascript

Code

protected function assertNodeByTitle(string $title, $content_type = NULL, $message = '') {
  if (!$message) {
    $message = "Node with title found: {$title}";
  }
  $node = $this
    ->getNodeByTitle($title, TRUE);
  $this
    ->assertNotEmpty($node, $message);
  if ($content_type) {
    $this
      ->assertEquals($node
      ->bundle(), $content_type, "Node is correct content type: {$content_type}");
  }
}