You are here

public function MediaFeedsMapperMediaTestCase::test in Media Feeds 7

Basic test importing a sample feed.

File

tests/media_feeds_mapper.test, line 36
Test case for the Feeds mapping API for the media module.

Class

MediaFeedsMapperMediaTestCase
Class for testing the Media Feeds media_internet mapper.

Code

public function test() {

  // Create a user with the appropriate permissions.
  $this
    ->drupalLogin($this
    ->drupalCreateUser(array(
    'administer content types',
    'administer feeds',
    'access content',
    'add media from remote sources',
    'import media',
    'view media',
    'edit media',
    'bypass node access',
  )));

  // Import a sample feed.
  $this
    ->importSampleFeed();

  // Assert: Media correctly attached.
  $entities = db_select('feeds_item')
    ->fields('feeds_item', array(
    'entity_id',
  ))
    ->condition('id', 'node')
    ->execute();
  foreach ($entities as $entity) {
    $this
      ->drupalGet('node/' . $entity->entity_id . '/edit');
    $this
      ->assertRaw('sample.png');
  }
}