public function ShareMessageViewModesTest::testShareMessageViewModes in Share Message 7
Checks whether view modes render expected markup.
File
- tests/
sharemessage.test, line 254 - ShareMessage tests.
Class
Code
public function testShareMessageViewModes() {
$edit = array(
'label' => 'ShareMessage Test Label',
'name' => 'sharemessage_test_label',
'sharemessage_title[en][0][value]' => 'ShareMessage Test Title',
'sharemessage_long[en][0][value]' => 'ShareMessage Test Long Description',
'sharemessage_short[en][0][value]' => 'ShareMessage Test Short Description',
'sharemessage_image_url[und][0][value]' => 'http://www.example.com/drupal.jpg',
'sharemessage_url[und][0][value]' => 'http://www.example.com',
);
$this
->drupalPost('admin/config/services/sharemessage/add', $edit, t('Save share message'));
$this
->assertText(t('Message @label saved.', array(
'@label' => $edit['label'],
)), t('ShareMessage is successfully saved.'));
$this
->drupalGet('sharemessage-test/1');
$this
->assertShareButtons($edit, TRUE);
$this
->assertOGTags($edit['sharemessage_title[en][0][value]']);
variable_set('sharemessage_view_default_view_mode', 'only_og_tags');
$this
->drupalGet('sharemessage-test/1');
$this
->assertShareButtons($edit, FALSE, TRUE);
$this
->assertOGTags($edit['sharemessage_title[en][0][value]']);
variable_set('sharemessage_view_default_view_mode', 'no_attributes');
$this
->drupalGet('sharemessage-test/1');
$this
->assertShareButtons($edit);
$this
->assertOGTags($edit['sharemessage_title[en][0][value]']);
variable_set('sharemessage_view_default_view_mode', 'attributes_only');
$this
->drupalGet('sharemessage-test/1');
$this
->assertShareButtons($edit, TRUE, FALSE);
$this
->assertOGTags($edit['sharemessage_title[en][0][value]'], TRUE);
}