class DateFormatsLockedTest
Same name in this branch
- 11.x core/modules/system/tests/src/Functional/System/DateFormatsLockedTest.php \Drupal\Tests\system\Functional\System\DateFormatsLockedTest
Same name and namespace in other branches
- 10 core/modules/system/tests/src/Functional/System/DateFormatsLockedTest.php \Drupal\Tests\system\Functional\System\DateFormatsLockedTest
- 9 core/modules/system/tests/src/Functional/System/DateFormatsLockedTest.php \Drupal\Tests\system\Functional\System\DateFormatsLockedTest
- 8.9.x core/modules/system/tests/src/Functional/System/DateFormatsLockedTest.php \Drupal\Tests\system\Functional\System\DateFormatsLockedTest
- main core/modules/system/tests/src/Functional/System/DateFormatsLockedTest.php \Drupal\Tests\system\Functional\System\DateFormatsLockedTest
- main core/modules/system/tests/src/Kernel/System/DateFormatsLockedTest.php \Drupal\Tests\system\Kernel\System\DateFormatsLockedTest
Tests the locked functionality of date formats.
Attributes
#[Group('system')]
#[RunTestsInSeparateProcesses]
Hierarchy
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\Tests\DrupalTestCaseTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\PhpUnitCompatibilityTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait, \Drupal\Tests\BrowserHtmlDebugTrait, \Drupal\Tests\HttpKernelUiHelperTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\system\Kernel\System\DateFormatsLockedTest uses \Drupal\Tests\user\Traits\UserCreationTrait extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of DateFormatsLockedTest
File
-
core/
modules/ system/ tests/ src/ Kernel/ System/ DateFormatsLockedTest.php, line 15
Namespace
Drupal\Tests\system\Kernel\SystemView source
class DateFormatsLockedTest extends KernelTestBase {
use UserCreationTrait {
createUser as drupalCreateUser;
}
/**
* {@inheritdoc}
*/
protected static $modules = [
'system',
'user',
];
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->installEntitySchema('user');
$this->installConfig([
'system',
]);
}
/**
* Tests attempts at listing, editing, and deleting locked date formats.
*/
public function testDateLocking() : void {
$this->setCurrentUser($this->drupalCreateUser([
'administer site configuration',
]));
// 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->assertSession()
->linkByHrefExists('admin/config/regional/date-time/formats/manage/short');
$this->assertSession()
->linkByHrefNotExists('admin/config/regional/date-time/formats/manage/html_date');
$this->assertSession()
->pageTextContains('Fallback date format');
$this->assertSession()
->pageTextNotContains('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.