function AggregatorTestBase::createSampleNodes

Creates sample article nodes.

Parameters

int $count: (optional) The number of nodes to generate. Defaults to five.

File

core/modules/aggregator/tests/src/Functional/AggregatorTestBase.php, line 390

Class

AggregatorTestBase
Defines a base class for testing the Aggregator module.

Namespace

Drupal\Tests\aggregator\Functional

Code

public function createSampleNodes($count = 5) {
  // Post $count article nodes.
  for ($i = 0; $i < $count; $i++) {
    $edit = [];
    $edit['title[0][value]'] = $this->randomMachineName();
    $edit['body[0][value]'] = $this->randomMachineName();
    $this->drupalGet('node/add/article');
    $this->submitForm($edit, 'Save');
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.