function DateFormatsLockedTest::testDateLocking

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/System/DateFormatsLockedTest.php \Drupal\Tests\system\Functional\System\DateFormatsLockedTest::testDateLocking()
  2. 10 core/modules/system/tests/src/Functional/System/DateFormatsLockedTest.php \Drupal\Tests\system\Functional\System\DateFormatsLockedTest::testDateLocking()
  3. 11.x core/modules/system/tests/src/Functional/System/DateFormatsLockedTest.php \Drupal\Tests\system\Functional\System\DateFormatsLockedTest::testDateLocking()

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

File

core/modules/system/tests/src/Functional/System/DateFormatsLockedTest.php, line 22

Class

DateFormatsLockedTest
Tests the locked functionality of date formats.

Namespace

Drupal\Tests\system\Functional\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->assertSession()
        ->statusCodeEquals(200);
    $this->drupalGet('admin/config/regional/date-time/formats/manage/html_date');
    $this->assertSession()
        ->statusCodeEquals(403);
    // Locked date formats are not deletable.
    $this->drupalGet('admin/config/regional/date-time/formats/manage/short/delete');
    $this->assertSession()
        ->statusCodeEquals(200);
    $this->drupalGet('admin/config/regional/date-time/formats/manage/html_date/delete');
    $this->assertSession()
        ->statusCodeEquals(403);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.