You are here

public function FeedsCSVtoRelationsTest::testSymmetricRelations in Relation 7

Test relation creation, refreshing/deleting feeds and feed items.

File

relation_feeds/tests/relation.feeds_processor.test, line 86

Class

FeedsCSVtoRelationsTest
Test aggregating a feed as data records.

Code

public function testSymmetricRelations() {

  // Go to mapping page and create a couple of mappings.
  $mappings = array(
    0 => array(
      'source' => 'user1',
      'target' => 'source_bundles:user:*:guid',
    ),
    1 => array(
      'source' => 'user2',
      'target' => 'source_bundles:user:*:guid',
    ),
  );
  $this
    ->setSettings('relation_import', 'RelationFeedsProcessor', array(
    'bundle' => 'loves',
  ));
  $this
    ->addMappings('relation_import', $mappings);

  // Import CSV file creating 'loves' relations between users.
  $this
    ->importFile('relation_import', $this
    ->absolutePath() . '/tests/feeds/user_relations.csv');

  // Assert results.
  $this
    ->assertText('Created 3 relations');
  $this
    ->assertText('Failed importing 2 relations');
}