You are here

protected function FeedsParaMapperWebTestCase::topHostParagraphsFieldExists in Feeds Paragraphs 7

Check that the top host field exists on the created node.

3 calls to FeedsParaMapperWebTestCase::topHostParagraphsFieldExists()
FeedsParaMapperNestedImportTestCase::testNestedImport in tests/importing.test
Test importing nodes with nested paragraphs fields.
FeedsParaMapperSingleValueTestCase::testImport in tests/importing.test
Test importing nodes with paragraphs field value.
FeedsParaMapperWebTestCase::multiImport in tests/FeedsParaMapperWebTestCase.test
Tests Multi-valued fields importing.

File

tests/FeedsParaMapperWebTestCase.test, line 419
Common functionality for all Paragraphs Mapper tests.

Class

FeedsParaMapperWebTestCase
Test basic functionality via DrupalWebTestCase.

Code

protected function topHostParagraphsFieldExists() {
  $node = node_load(1, NULL, TRUE);
  $host_field = "field_" . $this->paragraphField;
  $host_field_exists = isset($node->{$host_field});
  $message = "The host Paragraphs field exists on the node";
  $this
    ->assertTrue($host_field_exists, $message, "Importing");

  /*
      Check if the host Paragraphs field has the id
      of the created ParagraphsItemEntity.
  */
  $lang = $node->language;
  $id_exists = isset($node->{$host_field}[$lang][0]['value']);
  $message = "The host Paragraphs field has the id of the created ParagraphsItemEntity";
  $this
    ->assertTrue($id_exists, $message);
}