You are here

public function DateFormatsLockedTest::testDateLocking in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/System/DateFormatsLockedTest.php \Drupal\system\Tests\System\DateFormatsLockedTest::testDateLocking()

Tests attempts at listing, editing, and deleting locked date formats.

File

core/modules/system/src/Tests/System/DateFormatsLockedTest.php, line 22
Contains \Drupal\system\Tests\System\DateFormatsLockedTest.

Class

DateFormatsLockedTest
Tests the locked functionality of date formats.

Namespace

Drupal\system\Tests\System

Code

public function testDateLocking() {
  $this
    ->drupalLogin($this->rootUser);

  // Locked date formats are not linked on the listing page, locked date
  // formats are clearly marked as such; unlocked formats are not marked as
  // "locked".
  $this
    ->drupalGet('admin/config/regional/date-time');
  $this
    ->assertLinkByHref('admin/config/regional/date-time/formats/manage/short');
  $this
    ->assertNoLinkByHref('admin/config/regional/date-time/formats/manage/html_date');
  $this
    ->assertText('Fallback date format');
  $this
    ->assertNoText('short (locked)');

  // Locked date formats are not editable.
  $this
    ->drupalGet('admin/config/regional/date-time/formats/manage/short');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('admin/config/regional/date-time/formats/manage/html_date');
  $this
    ->assertResponse(403);

  // Locked date formats are not deletable.
  $this
    ->drupalGet('admin/config/regional/date-time/formats/manage/short/delete');
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('admin/config/regional/date-time/formats/manage/html_date/delete');
  $this
    ->assertResponse(403);
}