af68f33bdc20e11522cd131c67222d83a9f16c0e
[yaffs-website] / web / core / modules / config / tests / src / Functional / ConfigEntityStatusUITest.php
1 <?php
2
3 namespace Drupal\Tests\config\Functional;
4
5 use Drupal\Tests\BrowserTestBase;
6
7 /**
8  * Tests configuration entity status UI functionality.
9  *
10  * @group config
11  */
12 class ConfigEntityStatusUITest extends BrowserTestBase {
13
14   /**
15    * Modules to enable.
16    *
17    * @var array
18    */
19   public static $modules = ['config_test'];
20
21   /**
22    * Tests status operations.
23    */
24   public function testCRUD() {
25     $this->drupalLogin($this->drupalCreateUser(['administer site configuration']));
26
27     $id = strtolower($this->randomMachineName());
28     $edit = [
29       'id' => $id,
30       'label' => $this->randomMachineName(),
31     ];
32     $this->drupalPostForm('admin/structure/config_test/add', $edit, 'Save');
33
34     $entity = entity_load('config_test', $id);
35
36     // Disable an entity.
37     $disable_url = $entity->urlInfo('disable');
38     $this->assertLinkByHref($disable_url->toString());
39     $this->drupalGet($disable_url);
40     $this->assertResponse(200);
41     $this->assertNoLinkByHref($disable_url->toString());
42
43     // Enable an entity.
44     $enable_url = $entity->urlInfo('enable');
45     $this->assertLinkByHref($enable_url->toString());
46     $this->drupalGet($enable_url);
47     $this->assertResponse(200);
48     $this->assertNoLinkByHref($enable_url->toString());
49   }
50
51 }