*/ protected array $fixtures = ['app.Polls', 'app.Slides', 'app.SlideOptions', 'app.Responses']; protected function setUp(): void { parent::setUp(); $this->enableCsrfToken(); } public function testFragmentContainsRegionsButNoPageFrame(): void { [$poll, $token] = $this->createPoll(); $this->createSlide($poll, Slide::TYPE_CHOICE); $this->configRequest(['headers' => ['X-Fragment' => '1']]); $this->get("/admin/$token"); $this->assertResponseOk(); $this->assertResponseContains('data-refresh="slides"'); $this->assertResponseContains('data-refresh="head"'); $this->assertResponseContains('data-refresh="flash"'); $this->assertResponseNotContains('assertResponseNotContains('site-header'); } public function testFullPageKeepsFrameAndRegions(): void { [$poll, $token] = $this->createPoll(); $this->createSlide($poll, Slide::TYPE_CHOICE); $this->get("/admin/$token"); $this->assertResponseContains('assertResponseContains('data-refresh="flash"'); $this->assertResponseContains('createPoll(); $this->createSlide($poll, Slide::TYPE_CHOICE); $this->get("/admin/$token"); $this->assertResponseNotContains('onclick='); $this->assertResponseContains('data-confirm='); } public function testSlideFormFragmentIsTheDialogContent(): void { [$poll, $token] = $this->createPoll(); $slide = $this->createSlide($poll, Slide::TYPE_OPEN); $this->configRequest(['headers' => ['X-Fragment' => '1']]); $this->get("/admin/$token/slides/{$slide->id}/edit"); $this->assertResponseOk(); $this->assertResponseContains('data-modal-content'); $this->assertResponseNotContains('site-header'); } public function testValidationErrorKeepsTheFormInTheFragment(): void { [$poll, $token] = $this->createPoll(); $slide = $this->createSlide($poll, Slide::TYPE_OPEN); $this->configRequest(['headers' => ['X-Fragment' => '1']]); $this->post("/admin/$token/slides/{$slide->id}/edit", ['question' => '']); $this->assertResponseOk(); $this->assertResponseContains('data-modal-content'); $this->assertResponseContains('Bitte prüfe deine Eingaben.'); } public function testSuccessfulSaveRedirectsToTheDashboard(): void { [$poll, $token] = $this->createPoll(); $slide = $this->createSlide($poll, Slide::TYPE_OPEN); $this->configRequest(['headers' => ['X-Fragment' => '1']]); $this->post("/admin/$token/slides/{$slide->id}/edit", ['question' => 'Neue Frage']); $this->assertRedirect(['_name' => 'admin', 'token' => $token]); } }