You are here

protected function BxsliderTestCase::testEnableAndSetBxSliderFormat in BxSlider 7

Enable and set a BxSlider format.

File

./bxslider.test, line 40
Test cases for BxSlider.

Class

BxsliderTestCase
BxsliderTestCase.

Code

protected function testEnableAndSetBxSliderFormat() {

  // Login with admin user.
  $this
    ->drupalLogin($this->adminUser);

  // Select and set the "BxSlider" format.
  $optionset = array();
  $optionset['fields[field_image][type]'] = 'bxslider';
  $this
    ->drupalPost('admin/structure/types/manage/article/display', $optionset, t('Save'));
  $this
    ->assertResponse(200);
  $this
    ->assertText('Your settings have been saved.', t('Successfully selected and saved the "BxSlider" format'));

  // Select and set the "BxSlider - Thumbnail slider" format.
  $optionset = array();
  $optionset['fields[field_image][type]'] = 'bxslider_ths';
  $this
    ->drupalPost('admin/structure/types/manage/article/display', $optionset, t('Save'));
  $this
    ->assertResponse(200);
  $this
    ->assertText('Your settings have been saved.', t('Successfully selected and saved the "BxSlider - Thumbnail slider" format'));

  // Change some settings for the "BxSlider - Thumbnail slider" format.
  $this
    ->drupalPostAJAX('admin/structure/types/manage/article/display', NULL, 'field_image_formatter_settings_edit');
  $optionset = array();

  // Try enable an option Auto for the "BxSlider - Thumbnail slider" format.
  $optionset['fields[field_image][settings_edit_form][settings][thumbnail_slider][auto][auto]'] = TRUE;

  // Set the $path parameter to NULL for submitting to the same form. .
  $this
    ->drupalPostAJAX(NULL, $optionset, 'field_image_formatter_settings_update');
  $this
    ->drupalPost(NULL, NULL, t('Save'));
  $this
    ->assertResponse(200);
  $this
    ->assertText('Your settings have been saved.', t('Successfully changed settings for the "BxSlider - Thumbnail slider" format'));

  // Save the content type Article.
  $this
    ->DrupalGet('admin/structure/types/manage/article');
  $this
    ->drupalPost(NULL, NULL, t('Save content type'));
  $this
    ->assertResponse(200);
  $this
    ->assertText('The content type Article has been updated', t('Successfully saved the Article content type'));
}