Fix settings form being sent as PUT
CI / Deploy / test (push) Successful in 49s
CI / Deploy / deploy (push) Skipped

FormHelper adds a hidden _method=PUT for persisted entities, which the
POST-only admin:settings route rejected with a MissingRouteException.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
gnilebeinandClaude Opus 5.5 committed 2026-11-07 14:17:45 +01:00
1 parent c41005e6a2
commit 9dad7ab939
2 files changed
+12 -1

No files matched your search

@@ -49,6 +49,17 @@ class AdminControllerTest extends TestCase
$this->assertHeaderContains('X-Robots-Tag', 'noindex');
}
public function testSettingsFormPostsAndSaves(): void
{
[$poll, $token] = $this->createPoll('Alt');
$this->get("/admin/$token");
$this->assertResponseNotContains('name="_method" value="PUT"', 'settings form must not override method');
$this->post("/admin/$token/settings", ['title' => 'Neu', 'is_active' => '1', 'show_results_to_participants' => '0']);
$this->assertRedirect(['_name' => 'admin', 'token' => $token]);
$this->assertSame('Neu', $this->pollsTable()->get($poll->id)->title);
}
public function testTokenOfOtherPollCannotAccessSlides(): void
{
[$pollA] = $this->createPoll('A');