SlideTest.php in Nivo Slider 8
File
lib/Drupal/nivo_slider/Tests/SlideTest.php
View source
<?php
namespace Drupal\nivo_slider\Tests;
class SlideTest extends NivoSliderTestBase {
public static function getInfo() {
return [
'name' => 'Slides',
'description' => 'Test creating, editing and deleting slides.',
'group' => 'Nivo Slider',
];
}
public function testSlideTest() {
$this
->drupalGet('<front>');
$this
->assertNoRaw('//div[@id="slider"]', 'There is no slider on the front page.');
$this
->drupalGet('admin/structure/nivo-slider');
$this
->assertResponse(200, t('The privileged user can access the slider slides administration page.'));
$file = $this
->getTestImage();
for ($i = 0; $i <= 5; $i++) {
$edit = [];
$edit['files[upload]'] = drupal_realpath($file->uri);
$this
->drupalPost('admin/structure/nivo-slider', $edit, t('Save configuration'));
$this
->assertText(t('The configuration options have been saved.'));
}
$this
->drupalGet('<front>');
$elements = $this
->xpath('//div[@id="slider"]');
$this
->assertEqual(count($elements), 1, t('There is exactly one slider on the front page.'));
for ($i = 5; $i <= 0; $i--) {
$edit = [];
$edit["images[{$i}][delete]"] = TRUE;
$this
->drupalPost('admin/structure/nivo-slider', $edit, t('Save configuration'));
$this
->assertText(t('The configuration options have been saved.'));
}
}
}
Classes
Name |
Description |
SlideTest |
Test creating, editing and deleting slides. |