Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / modules / block / tests / src / Functional / BlockTest.php
index 7518c82dc136e7351421733889510c7829044f64..9fb33573c46cbf4bc42e3d0c68abc9093c145c09 100644 (file)
@@ -146,7 +146,7 @@ class BlockTest extends BlockTestBase {
       $block_name = 'system_powered_by_block';
       $add_url = Url::fromRoute('block.admin_add', [
         'plugin_id' => $block_name,
-        'theme' => $default_theme
+        'theme' => $default_theme,
       ]);
       $links = $this->xpath('//a[contains(@href, :href)]', [':href' => $add_url->toString()]);
       $this->assertEqual(1, count($links), 'Found one matching link.');
@@ -238,6 +238,30 @@ class BlockTest extends BlockTestBase {
     $this->assertNoRaw($block->id());
   }
 
+  /**
+   * Tests the block operation links.
+   */
+  public function testBlockOperationLinks() {
+    $this->drupalGet('admin/structure/block');
+    // Go to the select block form.
+    $this->clickLink('Place block');
+    // Select the first available block.
+    $this->clickLink('Place block');
+    // Finally place the block
+    $this->submitForm([], 'Save block');
+
+    $url = $this->getUrl();
+    $parsed = parse_url($url);
+    $this->assertContains('block-placement', $parsed['query']);
+
+    $this->clickLink('Remove');
+    $this->submitForm([], 'Remove');
+
+    $url = $this->getUrl();
+    $parsed = parse_url($url);
+    $this->assertTrue(empty($parsed['query']));
+  }
+
   /**
    * Tests that the block form has a theme selector when not passed via the URL.
    */
@@ -537,14 +561,14 @@ class BlockTest extends BlockTestBase {
 
     $this->assertEqual($block->getVisibility()['user_role']['roles'], [
       $role1->id() => $role1->id(),
-      $role2->id() => $role2->id()
+      $role2->id() => $role2->id(),
     ]);
 
     $role1->delete();
 
     $block = Block::load($block->id());
     $this->assertEqual($block->getVisibility()['user_role']['roles'], [
-      $role2->id() => $role2->id()
+      $role2->id() => $role2->id(),
     ]);
   }