You are here

protected function YamlFormTestTrait::getNodes in YAML Form 8

Get nodes keyed by nid.

Return value

\Drupal\node\NodeInterface[] Associative array of nodes keyed by nid.

2 calls to YamlFormTestTrait::getNodes()
YamlFormResultsExportTest::testExportOptions in src/Tests/YamlFormResultsExportTest.php
Tests export options.
YamlFormTestTrait::createYamlFormWithSubmissions in src/Tests/YamlFormTestTrait.php
Create a form with submissions.

File

src/Tests/YamlFormTestTrait.php, line 213

Class

YamlFormTestTrait
Defines form test trait.

Namespace

Drupal\yamlform\Tests

Code

protected function getNodes() {
  if (empty($this->nodes)) {
    $this
      ->drupalCreateContentType([
      'type' => 'page',
    ]);
    for ($i = 0; $i < 3; $i++) {
      $this->nodes[$i] = $this
        ->drupalCreateNode([
        'type' => 'page',
        'title' => 'Node ' . $i,
        'status' => NODE_PUBLISHED,
      ]);
      $this
        ->drupalGet('node/' . $this->nodes[$i]
        ->id());
    }
  }
  return $this->nodes;
}