You are here

public function TweetBundleTest::testMediaBundleCreationFromModule in D7 Media 8

Tests tweet media bundle creation from config files.

File

src/Tests/TweetBundleTest.php, line 65

Class

TweetBundleTest
Ensures that media bundle for tweets can be created.

Namespace

Drupal\media\Tests

Code

public function testMediaBundleCreationFromModule() {
  $type_configuration = [
    'use_twitter_api' => FALSE,
    'source_field' => 'field_tweet_url',
    'consumer_key' => '',
    'consumer_secret' => '',
    'oauth_access_token' => '',
    'oauth_access_token_secret' => '',
  ];
  $field_map = [
    'id' => 'field_tweet_id',
    'user' => 'field_tweet_author',
  ];
  $this
    ->assertTrue((bool) $this->testBundle, 'The media bundle from default configuration has been created in the database.');
  $this
    ->assertEqual($this->testBundle
    ->get('label'), 'Tweet', 'Correct label detected.');
  $this
    ->assertEqual($this->testBundle
    ->get('description'), 'Use this to embed Twitter content on your site.', 'Correct description detected.');
  $this
    ->assertEqual($this->testBundle
    ->get('type'), 'twitter', 'Correct plugin ID detected.');
  $this
    ->assertEqual($this->testBundle
    ->get('type_configuration'), $type_configuration, 'Type configuration correct.');
  $this
    ->assertEqual($this->testBundle
    ->get('field_map'), $field_map, 'Correct field map detected.');
}