Merge pull request 'Let the presenter resume a paused poll with the pause button' (#38) from fix/presenter-resume into main
Reviewed-on: #38
This commit was merged in pull request #38.
This commit is contained in:
commit
e9e1159ad9
5 files changed
+52
-9
No files matched your search
@@ -289,6 +289,34 @@ class AdminControllerTest extends TestCase
|
||||
$this->assertSame($second->id, $this->pollsTable()->get($poll->id)->current_slide_id, 'stays on last slide');
|
||||
}
|
||||
|
||||
public function testPauseAndResumeAreIdempotent(): void
|
||||
{
|
||||
[$poll, $token] = $this->createPoll();
|
||||
$this->createSlide($poll, Slide::TYPE_CHOICE);
|
||||
$second = $this->createSlide($poll, Slide::TYPE_WORDCLOUD);
|
||||
$this->get("/admin/$token/present");
|
||||
$this->configRequest(['headers' => ['Accept' => 'application/json']]);
|
||||
$this->post("/admin/$token/control", ['action' => 'goto', 'slide_id' => $second->id]);
|
||||
|
||||
foreach ([1, 2] as $attempt) {
|
||||
$this->configRequest(['headers' => ['Accept' => 'application/json']]);
|
||||
$this->post("/admin/$token/control", ['action' => 'stop']);
|
||||
$this->assertResponseOk();
|
||||
$state = json_decode((string)$this->_response->getBody(), true);
|
||||
$this->assertNull($state['slide'], "paused after stop #$attempt");
|
||||
$this->assertTrue($state['poll']['isPaused']);
|
||||
}
|
||||
|
||||
foreach ([1, 2] as $attempt) {
|
||||
$this->configRequest(['headers' => ['Accept' => 'application/json']]);
|
||||
$this->post("/admin/$token/control", ['action' => 'resume']);
|
||||
$this->assertResponseOk();
|
||||
$state = json_decode((string)$this->_response->getBody(), true);
|
||||
$this->assertSame($second->id, $state['slide']['id'], "resumes the paused slide (#$attempt)");
|
||||
$this->assertFalse($state['poll']['isPaused']);
|
||||
}
|
||||
}
|
||||
|
||||
public function testControlRejectsSlideOfOtherPoll(): void
|
||||
{
|
||||
[, $token] = $this->createPoll('A');
|
||||
|
||||
Reference in new issue
Block a user