You are here

function PollViewTest::testAdminView in Poll 8

Test with/without permission and with/without a poll.

File

tests/src/Functional/PollViewTest.php, line 15

Class

PollViewTest
Tests the poll admin view.

Namespace

Drupal\Tests\poll\Functional

Code

function testAdminView() {
  $this
    ->drupalGet('admin/content/poll');
  $this
    ->assertResponse(200);
  $this
    ->assertText($this->poll
    ->label());

  // Delete all polls, make sure that we get an empty message.
  $this->poll
    ->delete();
  $this
    ->drupalGet('admin/content/poll');
  $this
    ->assertText('No polls are available.');
  $test_user = $this
    ->createUser([
    'access administration pages',
  ]);
  $this
    ->drupalLogin($test_user);
  $this
    ->drupalGet('admin/content/poll');
  $this
    ->assertResponse(403);
}