CountdownBlockTest.php in Countdown 8
File
tests/src/Functional/CountdownBlockTest.php
View source
<?php
namespace Drupal\Tests\countdown\Functional;
use Drupal\Tests\BrowserTestBase;
class CountdownBlockTest extends BrowserTestBase {
protected $strictConfigSchema = FALSE;
protected $adminUser;
public static $modules = [
'block',
'countdown',
];
protected function setUp() {
parent::setUp();
$this->adminUser = $this
->drupalCreateUser([
'administer blocks',
]);
$this
->drupalLogin($this->adminUser);
}
public function testCountdownBlockVisibility() {
$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.");
}
}