You are here

public function CountdownBlockTest::testCountdownBlockVisibility in Countdown 8

Tests the visibility settings for the CountdownBlock.

File

tests/src/Functional/CountdownBlockTest.php, line 52

Class

CountdownBlockTest
Tests if the Countdown form block is available.

Namespace

Drupal\Tests\countdown\Functional

Code

public function testCountdownBlockVisibility() {

  // Check if the visibility setting is available.
  $default_theme = $this
    ->config('system.theme')
    ->get('default');
  $this
    ->drupalGet('admin/structure/block/add/countdown_block' . '/' . $default_theme);
  $edit = [
    'region' => 'sidebar_first',
  ];
  $this
    ->drupalPostForm('admin/structure/block/add/countdown_block' . '/' . $default_theme, $edit, t('Save block'));
  $this
    ->assertResponse(200);
  $this
    ->assertText(t('Event Name field is required.'), "Make sure you have insert proper event name.");
  $edit2 = [];
  $edit2['settings[countdown_event_name]'] = 'Test Block';
  $edit2['region'] = 'sidebar_first';
  $this
    ->drupalPostForm('admin/structure/block/add/countdown_block' . '/' . $default_theme, $edit2, t('Save block'));
  $this
    ->assertResponse(200);
  $this
    ->assertText(t('The block configuration has been saved.'), "Make sure you have event details properly.");
}