core/lib/Drupal/Core/Form/FormBuilder.php | 5 ----- .../block/src/Tests/Views/DisplayBlockTest.php | 10 ++++------ core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php | 19 +++++-------------- 3 files changed, 9 insertions(+), 25 deletions(-) diff --git a/core/lib/Drupal/Core/Form/FormBuilder.php b/core/lib/Drupal/Core/Form/FormBuilder.php index 6e64d0c..adf4c86 100644 --- a/core/lib/Drupal/Core/Form/FormBuilder.php +++ b/core/lib/Drupal/Core/Form/FormBuilder.php @@ -674,11 +674,6 @@ public function prepareForm($form_id, &$form, FormStateInterface &$form_state) { $form['#action'] = $placeholder; } - // If the form method is specified in the form, pass it on to FormState. - if (isset($form['#method'])) { - $form_state->setMethod($form['#method']); - } - // Fix the form method, if it is 'get' in $form_state, but not in $form. if ($form_state->isMethodType('get') && !isset($form['#method'])) { $form['#method'] = 'get'; diff --git a/core/modules/block/src/Tests/Views/DisplayBlockTest.php b/core/modules/block/src/Tests/Views/DisplayBlockTest.php index 80bcde7..9b85831 100644 --- a/core/modules/block/src/Tests/Views/DisplayBlockTest.php +++ b/core/modules/block/src/Tests/Views/DisplayBlockTest.php @@ -8,7 +8,6 @@ namespace Drupal\block\Tests\Views; use Drupal\Component\Serialization\Json; -use Drupal\Core\Url; use Drupal\system\Tests\Cache\AssertPageCacheContextsAndTagsTrait; use Drupal\views\Entity\View; use Drupal\views\Views; @@ -272,7 +271,6 @@ public function testBlockRendering() { * Tests the various testcases of empty block rendering. */ public function testBlockEmptyRendering() { - $url = new Url('test_page_test.test_page'); // Remove all views_test_data entries. \Drupal::database()->truncate('views_test_data')->execute(); /** @var \Drupal\views\ViewEntityInterface $view */ @@ -287,7 +285,7 @@ public function testBlockEmptyRendering() { $display['display_options']['block_hide_empty'] = TRUE; $view->save(); - $this->drupalGet($url); + $this->drupalGet(''); $this->assertEqual(0, count($this->xpath('//div[contains(@class, "block-views-blocktest-view-block-block-1")]'))); // Ensure that the view cachability metadata is propagated even, for an // empty block. @@ -307,7 +305,7 @@ public function testBlockEmptyRendering() { ]; $view->save(); - $this->drupalGet($url); + $this->drupalGet(''); $this->assertEqual(1, count($this->xpath('//div[contains(@class, "block-views-blocktest-view-block-block-1")]'))); $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:system.site', 'config:views.view.test_view_block' ,'rendered'])); $this->assertCacheContexts(['url.path', 'url.query_args', 'user.roles:authenticated']); @@ -325,7 +323,7 @@ public function testBlockEmptyRendering() { ]; $view->save(); - $this->drupalGet($url); + $this->drupalGet(''); $this->assertEqual(0, count($this->xpath('//div[contains(@class, "block-views-blocktest-view-block-block-1")]'))); $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:system.site', 'config:views.view.test_view_block' ,'rendered'])); $this->assertCacheContexts(['url.path', 'url.query_args', 'user.roles:authenticated']); @@ -342,7 +340,7 @@ public function testBlockEmptyRendering() { ]; $view->save(); - $this->drupalGet($url); + $this->drupalGet(''); $this->assertEqual(1, count($this->xpath('//div[contains(@class, "block-views-blocktest-view-block-block-1")]'))); $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:system.site', 'config:views.view.test_view_block' ,'rendered'])); $this->assertCacheContexts(['url.path', 'url.query_args', 'user.roles:authenticated']); diff --git a/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php b/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php index 790ad86..d95e3bc 100644 --- a/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php +++ b/core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php @@ -773,7 +773,7 @@ public function providerTestInvalidToken() { * * @dataProvider providerTestFormTokenCacheability */ - function testFormTokenCacheability($token, $action, $is_authenticated, $expected_form_cacheability, $expected_token_cacheability) { + function testFormTokenCacheability($token, $is_authenticated, $expected_form_cacheability, $expected_token_cacheability) { $user = $this->prophesize(AccountProxyInterface::class); $user->isAuthenticated() ->willReturn($is_authenticated); @@ -787,10 +787,6 @@ function testFormTokenCacheability($token, $action, $is_authenticated, $expected $form['#token'] = $token; } - if (isset($action)) { - $form['#action'] = $action; - } - $form_arg = $this->getMock('Drupal\Core\Form\FormInterface'); $form_arg->expects($this->once()) ->method('getFormId') @@ -824,15 +820,10 @@ function testFormTokenCacheability($token, $action, $is_authenticated, $expected */ function providerTestFormTokenCacheability() { return [ - '#token:none,#action:something,authenticated:true' => [NULL, '/some/path', TRUE, ['contexts' => ['user.roles:authenticated']], ['max-age' => 0]], - '#token:false,#action:something,authenticated:true' => [FALSE, '/some/path', TRUE, NULL, NULL], - '#token:none,#action:something,authenticated:false' => [NULL, '/some/path', FALSE, ['contexts' => ['user.roles:authenticated']], NULL], - '#token:false,#action:something,authenticated:false' => [FALSE, '/some/path', FALSE, NULL, NULL], - - '#token:none,#action:none,authenticated:true' => [NULL, NULL, TRUE, ['contexts' => ['url.path', 'url.query_args', 'user.roles:authenticated']], ['max-age' => 0]], - '#token:false,#action:none,authenticated:true' => [FALSE, NULL, TRUE, ['contexts' => ['url.path', 'url.query_args']], NULL], - '#token:none,#action:none,authenticated:false' => [NULL, NULL, FALSE, ['contexts' => ['url.path', 'url.query_args', 'user.roles:authenticated']], NULL], - '#token:false,#action:none,authenticated:false' => [FALSE, NULL, FALSE, ['contexts' => ['url.path', 'url.query_args']], NULL], + 'token:none,authenticated:true' => [NULL, TRUE, ['contexts' => ['user.roles:authenticated']], ['max-age' => 0]], + 'token:false,authenticated:true' => [FALSE, TRUE, NULL, NULL], + 'token:none,authenticated:false' => [NULL, FALSE, ['contexts' => ['user.roles:authenticated']], NULL], + 'token:false,authenticated:false' => [FALSE, FALSE, NULL, NULL], ]; }