You are here

function AggregatorTestCase::createSampleNodes in Drupal 7

Creates sample article nodes.

Parameters

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

6 calls to AggregatorTestCase::createSampleNodes()
AggregatorCronTestCase::testCron in modules/aggregator/aggregator.test
Adds feeds and updates them via cron process.
AggregatorRenderingTestCase::testBlockLinks in modules/aggregator/aggregator.test
Adds a feed block to the page and checks its links.
AggregatorRenderingTestCase::testFeedPage in modules/aggregator/aggregator.test
Creates a feed and checks that feed's page.
CategorizeFeedItemTestCase::testCategorizeFeedItem in modules/aggregator/aggregator.test
Checks that children of a feed inherit a defined category.
CategorizeFeedTestCase::testCategorizeFeed in modules/aggregator/aggregator.test
Creates a feed and makes sure you can add/delete categories to it.

... See full list

File

modules/aggregator/aggregator.test, line 301
Tests for aggregator.module.

Class

AggregatorTestCase
Defines a base class for testing the Aggregator module.

Code

function createSampleNodes($count = 5) {
  $langcode = LANGUAGE_NONE;

  // Post $count article nodes.
  for ($i = 0; $i < $count; $i++) {
    $edit = array();
    $edit['title'] = $this
      ->randomName();
    $edit["body[{$langcode}][0][value]"] = $this
      ->randomName();
    $this
      ->drupalPost('node/add/article', $edit, t('Save'));
  }
}