You are here

protected function FeedsOgTest::setUpStuffForTestingOgReferenceWithoutAuthorizing in Feeds 7.2

Sets up stuff for testing with the authorize option turned off.

Does the following:

  • Creates an account;
  • Creates two group nodes;
  • Adds mapping to og reference.
  • Creates a feed node.

Return value

object[] The two created group nodes.

2 calls to FeedsOgTest::setUpStuffForTestingOgReferenceWithoutAuthorizing()
FeedsOgTest::testImportOgReferenceWithoutAuthorizing in tests/feeds_og.test
Tests importing content for a group using the web UI.
FeedsOgTest::testImportOgReferenceWithoutAuthorizingOnCron in tests/feeds_og.test
Tests importing content for a group on cron runs.

File

tests/feeds_og.test, line 99
Contains FeedsOgTest.

Class

FeedsOgTest
Tests for Organic Groups integration.

Code

protected function setUpStuffForTestingOgReferenceWithoutAuthorizing() {

  // Disable "authorize" option.
  $this
    ->setSettings('syndication', 'FeedsNodeProcessor', array(
    'authorize' => FALSE,
  ));

  // Create an account who will own a group.
  $group_owner = $this
    ->drupalCreateUser();

  // Create two groups.
  $group1 = $this
    ->createGroup('Lorem', $group_owner->uid);
  $group2 = $this
    ->createGroup('Ut wisi', $group_owner->uid);

  // Use source 'alpha' as group name.
  $this
    ->addMappings('syndication', array(
    1 => array(
      'source' => 'alpha',
      'target' => 'og_group_ref:label',
    ),
  ));

  // Create a feed node and change author of node.
  $nid = $this
    ->createFeedNode('syndication', $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . '/tests/feeds/content.csv', 'Node 1');
  $account = $this
    ->drupalCreateUser(array(
    'access content',
    'create article content',
  ));
  $this
    ->changeNodeAuthor($nid, $account);
  return array(
    $group1,
    $group2,
  );
}