You are here

protected function ExportTest::updateNode in Acquia Content Hub 8.2

Updates the node.

Parameters

int $nid: Node id.

int $items_expected: Expected number of items in the queue.

array $cdf_expectations: The sets of expectation arguments for CDF object validation.

Throws

\Drupal\Core\Entity\EntityStorageException

2 calls to ExportTest::updateNode()
ExportTest::testPublishing in tests/src/Kernel/ExportTest.php
Tests Acquia ContentHub content/configuration export.
ExportTest::testQueue in tests/src/Kernel/ExportTest.php
Tests Acquia ContentHub export queue.

File

tests/src/Kernel/ExportTest.php, line 1161

Class

ExportTest
Tests entity exports.

Namespace

Drupal\Tests\acquia_contenthub\Kernel

Code

protected function updateNode($nid, &$items_expected, array &$cdf_expectations = []) {
  $title = $this
    ->randomString(30);
  $field_value = $this
    ->randomString(100);
  $node = Node::load($nid);
  $node
    ->set('title', $title);
  $node
    ->set('field_1', $field_value);
  $node
    ->set('status', Node::PUBLISHED);
  $node
    ->save();
  $items_expected = 1;
  $bundle = 'test_content_type';
  $field = [
    'field_1' => [
      'value' => [
        'en' => [
          'value' => $field_value,
        ],
      ],
    ],
    'field_term_reference' => [
      'value' => [
        'en' => [],
      ],
    ],
  ];
  $field_metadata = [
    'field_1' => [
      'type' => 'string_long',
    ],
    'field_term_reference' => [
      'type' => 'entity_reference',
      'target' => 'taxonomy_term',
    ],
  ];
  $cdf_expectations = [
    [
      $nid,
      $title,
      $bundle,
      Node::PUBLISHED,
      $field,
      $field_metadata,
    ],
  ];
}