public function HijriBlockDisplayTest::testLongDisplay in Hijri 1.0.x
Same name and namespace in other branches
- 3.0.x tests/src/Functional/HijriBlockDisplayTest.php \Drupal\Tests\hijri\Functional\HijriBlockDisplayTest::testLongDisplay()
File
- tests/
Functional/ HijriBlockDisplayTest.php, line 86
Class
Namespace
Drupal\Tests\hijri\FunctionalCode
public function testLongDisplay() {
$this
->drupalLogin($this
->createUser([
'administer hijri',
]));
$this
->drupalGet('admin/config/regional/date-time/hijri');
$this->assert
->statusCodeEquals(200);
$edit = [
'hijri_correction_value' => 0,
'hijri_display_block' => 'long',
];
$this
->submitForm($edit, 'Save configuration');
// Create user.
$web_user = $this
->drupalCreateUser([
'administer blocks',
]);
// Login the admin user.
$this
->drupalLogin($web_user);
$theme_name = 'stark';
// Verify the blocks are listed to be added.
$this
->drupalGet('/admin/structure/block/library/' . $theme_name, [
'query' => [
'region' => 'content',
],
]);
$this->assert
->pageTextContains('Hijri Date');
// Define and place blocks.
$settings_configurable = [
'label' => 'Hijri Date',
'id' => 'hijri_date_block',
'theme' => $theme_name,
];
$this
->drupalPlaceBlock('hijri_date_block', $settings_configurable);
$this
->drupalGet('');
$this->assert
->pageTextContains($settings_configurable['label']);
$this->assert
->pageTextContainsOnce(t('@datetime', [
'@datetime' => $this->hijri_formatter
->format(time(), (string) \Drupal::config('hijri.config')
->get('hijri_display_block')),
]));
}