You are here

public function EnqueueFormTest::testEmptyEnqueueForm in Warmer 2.x

Same name and namespace in other branches
  1. 8 modules/warmer_entity/tests/src/Functional/EnqueueFormTest.php \Drupal\Tests\warmer_entity\Functional\EnqueueFormTest::testEmptyEnqueueForm()

Asserts the enqueue form empty functionality.

File

modules/warmer_entity/tests/src/Functional/EnqueueFormTest.php, line 74

Class

EnqueueFormTest
Functional test for the form enqueue functionality.

Namespace

Drupal\Tests\warmer_entity\Functional

Code

public function testEmptyEnqueueForm() {
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet(Url::fromRoute('warmer.enqueue'));
  $assertions = $this
    ->assertSession();
  $assertions
    ->buttonExists('Warm Caches');

  // There is only one warmer in this test.
  $elements = $this
    ->xpath('//table[@id="edit-warmers"]/tbody/tr');
  $this
    ->assertCount(1, $elements);
  $this
    ->click('#edit-submit');
  $elements = $this
    ->cssSelect('div.messages');
  $element = reset($elements);
  $this
    ->assertEquals($element
    ->getText(), 'Status message 0 items enqueued for cache warming.');
}