You are here

protected function Select2BoxesTestsBase::generateDummyContent in Select2 Boxes 8

Generates a specified number of nodes of select2boxes_test_content_type.

Parameters

int $count: Number of nodes that needs to be generated.

Return value

\Drupal\node\Entity\Node[] Generated nodes objects.

3 calls to Select2BoxesTestsBase::generateDummyContent()
Select2BefTests::testFilterForTagFields in modules/select2_bef/tests/src/FunctionalJavascript/Select2BefTests.php
Test filter for tag fields.
Select2BefTests::testListExposedFilters in modules/select2_bef/tests/src/FunctionalJavascript/Select2BefTests.php
Test list exposed filters.
Select2BoxesTests::testMultipleWidget in tests/src/FunctionalJavascript/Select2BoxesTests.php
Test multiple widget for entity reference fields.

File

tests/src/FunctionalJavascript/Select2BoxesTestsBase.php, line 105

Class

Select2BoxesTestsBase
Class Select2BoxesTestsBase.

Namespace

Drupal\Tests\select2boxes\FunctionalJavascript

Code

protected function generateDummyContent($count) {
  $nodes = [];
  for ($i = 0; $i <= $count; $i++) {
    $nodes[$i] = Node::create([
      'type' => 'select2boxes_test_content_type',
      'title' => $this
        ->randomString(4),
    ]);
    $nodes[$i]
      ->save();
  }
  return $nodes;
}