OptionTest.php in Nivo Slider 8
File
lib/Drupal/nivo_slider/Tests/OptionTest.php
View source
<?php
namespace Drupal\nivo_slider\Tests;
class OptionTest extends NivoSliderTestBase {
public static function getInfo() {
return [
'name' => 'Options',
'description' => 'Test configuring slider options.',
'group' => 'Nivo Slider',
];
}
public function testOptionTest() {
$file = $this
->getTestImage();
$edit = [];
$edit['files[upload]'] = drupal_realpath($file->uri);
$this
->drupalPost('admin/structure/nivo-slider', $edit, t('Save configuration'));
$this
->drupalGet('admin/structure/nivo-slider/options');
$this
->assertResponse(200, t('The privileged user can access the slider options administration page.'));
$themes = [
'bar',
'dark',
'default',
'light',
];
foreach ($themes as $theme) {
$edit = [];
$edit['nivo_slider_theme'] = $theme;
$this
->drupalPost('admin/structure/nivo-slider/options', $edit, t('Save configuration'));
$this
->drupalGet('<front>');
$elements = $this
->xpath('//div[@class="slider-wrapper theme-' . $theme . '"]');
$this
->assertEqual(count($elements), 1, t('There is exactly one slider with the current theme on the front page.'));
}
}
}