function ConfigEntityStatusUITest::testCRUD
Same name in other branches
- 9 core/modules/config/tests/src/Functional/ConfigEntityStatusUITest.php \Drupal\Tests\config\Functional\ConfigEntityStatusUITest::testCRUD()
- 10 core/modules/config/tests/src/Functional/ConfigEntityStatusUITest.php \Drupal\Tests\config\Functional\ConfigEntityStatusUITest::testCRUD()
- 11.x core/modules/config/tests/src/Functional/ConfigEntityStatusUITest.php \Drupal\Tests\config\Functional\ConfigEntityStatusUITest::testCRUD()
Tests status operations.
File
-
core/
modules/ config/ tests/ src/ Functional/ ConfigEntityStatusUITest.php, line 29
Class
- ConfigEntityStatusUITest
- Tests configuration entity status UI functionality.
Namespace
Drupal\Tests\config\FunctionalCode
public function testCRUD() {
$this->drupalLogin($this->drupalCreateUser([
'administer site configuration',
]));
$id = strtolower($this->randomMachineName());
$edit = [
'id' => $id,
'label' => $this->randomMachineName(),
];
$this->drupalPostForm('admin/structure/config_test/add', $edit, 'Save');
$entity = \Drupal::entityTypeManager()->getStorage('config_test')
->load($id);
// Disable an entity.
$disable_url = $entity->toUrl('disable');
$this->assertLinkByHref($disable_url->toString());
$this->drupalGet($disable_url);
$this->assertSession()
->statusCodeEquals(200);
$this->assertNoLinkByHref($disable_url->toString());
// Enable an entity.
$enable_url = $entity->toUrl('enable');
$this->assertLinkByHref($enable_url->toString());
$this->drupalGet($enable_url);
$this->assertSession()
->statusCodeEquals(200);
$this->assertNoLinkByHref($enable_url->toString());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.