annotate core/modules/config/tests/src/Functional/ConfigEntityStatusUITest.php @ 13:5fb285c0d0e3

Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've been lucky to get away with this so far, as we don't support self-registration which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5 was vulnerable to.
author Chris Cannam
date Mon, 23 Apr 2018 09:33:26 +0100
parents 4c8ae668cc8c
children af1871eacc83
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\Tests\config\Functional;
Chris@0 4
Chris@0 5 use Drupal\Tests\BrowserTestBase;
Chris@0 6
Chris@0 7 /**
Chris@0 8 * Tests configuration entity status UI functionality.
Chris@0 9 *
Chris@0 10 * @group config
Chris@0 11 */
Chris@0 12 class ConfigEntityStatusUITest extends BrowserTestBase {
Chris@0 13
Chris@0 14 /**
Chris@0 15 * Modules to enable.
Chris@0 16 *
Chris@0 17 * @var array
Chris@0 18 */
Chris@0 19 public static $modules = ['config_test'];
Chris@0 20
Chris@0 21 /**
Chris@0 22 * Tests status operations.
Chris@0 23 */
Chris@0 24 public function testCRUD() {
Chris@0 25 $this->drupalLogin($this->drupalCreateUser(['administer site configuration']));
Chris@0 26
Chris@0 27 $id = strtolower($this->randomMachineName());
Chris@0 28 $edit = [
Chris@0 29 'id' => $id,
Chris@0 30 'label' => $this->randomMachineName(),
Chris@0 31 ];
Chris@0 32 $this->drupalPostForm('admin/structure/config_test/add', $edit, 'Save');
Chris@0 33
Chris@0 34 $entity = entity_load('config_test', $id);
Chris@0 35
Chris@0 36 // Disable an entity.
Chris@0 37 $disable_url = $entity->urlInfo('disable');
Chris@0 38 $this->assertLinkByHref($disable_url->toString());
Chris@0 39 $this->drupalGet($disable_url);
Chris@0 40 $this->assertResponse(200);
Chris@0 41 $this->assertNoLinkByHref($disable_url->toString());
Chris@0 42
Chris@0 43 // Enable an entity.
Chris@0 44 $enable_url = $entity->urlInfo('enable');
Chris@0 45 $this->assertLinkByHref($enable_url->toString());
Chris@0 46 $this->drupalGet($enable_url);
Chris@0 47 $this->assertResponse(200);
Chris@0 48 $this->assertNoLinkByHref($enable_url->toString());
Chris@0 49 }
Chris@0 50
Chris@0 51 }