You are here

protected function EncryptingExistingDataTest::createTestNode in Field Encryption 3.0.x

Creates a test node.

Overrides FieldEncryptTestBase::createTestNode

1 call to EncryptingExistingDataTest::createTestNode()
EncryptingExistingDataTest::testEncryptingExistingData in tests/src/Functional/EncryptingExistingDataTest.php
Tests that existing entities can be encrypted.

File

tests/src/Functional/EncryptingExistingDataTest.php, line 105

Class

EncryptingExistingDataTest
Tests encrypting fields on entities that already exist.

Namespace

Drupal\Tests\field_encrypt\Functional

Code

protected function createTestNode() {
  $counter = count($this->testNodes) + 1;
  $node = $this
    ->createNode([
    'title' => 'Test node ' . $counter,
    'field_test_single' => [
      [
        'value' => "Lorem ipsum dolor sit amet.",
        'summary' => "Lorem ipsum",
        'format' => filter_default_format(),
      ],
    ],
    'field_test_multi' => [
      [
        'value' => "one lorem",
      ],
      [
        'value' => "two lorem",
      ],
      [
        'value' => "three lorem",
      ],
    ],
  ]);
  $node
    ->setNewRevision(TRUE);
  $node->title = 'Test node revision' . $counter;
  $node
    ->setRevisionLogMessage('Test log message');
  $node
    ->save();
  $this->testNodes[] = $node;
}