IntegrationSmokeTest.php in Views Infinite Scroll 8
File
tests/src/Functional/IntegrationSmokeTest.php
View source
<?php
namespace Drupal\Tests\views_infinite_scroll\Functional;
use Drupal\Tests\BrowserTestBase;
class IntegrationSmokeTest extends BrowserTestBase {
protected $defaultTheme = 'stark';
public static $modules = [
'views',
'views_ui',
'views_infinite_scroll',
];
protected function setUp() {
parent::setUp();
$this
->drupalLogin($this
->createUser([
'administer views',
]));
}
public function testPlugin() {
$this
->drupalGet('admin/structure/views/add');
$this
->submitForm([
'label' => 'Test Plugin',
'id' => 'test_plugin',
'page[create]' => '1',
'page[title]' => 'Test Plugin',
'page[path]' => 'test-plugin',
], 'Save and edit');
$this
->clickLink('Mini');
$this
->submitForm([
'pager[type]' => 'infinite_scroll',
], 'Apply');
$this
->submitForm([
'pager_options[views_infinite_scroll][button_text]' => 'More Please',
'pager_options[views_infinite_scroll][automatically_load_content]' => '',
], 'Apply');
$this
->assertSession()
->linkExists('Infinite Scroll');
$this
->assertSession()
->pageTextContains('Click to load, 10 items');
$this
->submitForm([], 'Save');
$this
->clickLink('Permission');
$this
->submitForm([
'access[type]' => 'none',
], 'Apply');
$this
->submitForm([], 'Save');
$this
->drupalGet('test-plugin');
$this
->assertSession()
->responseContains('data-drupal-views-infinite-scroll-content-wrapper');
}
}