public function test_it_sorts_events() { $events = [new BuzzReceivedEvent(new Contestant("Fred"), 20), new BuzzReceivedEvent(new Contestant("Joe"), 60), new BuzzReceivedEvent(new Contestant("Murphy"), 10)]; $resolver = new Resolver($events); $resolution = $resolver->resolve(); $this->assertInstanceOf(BuzzerResolution::class, $resolution); $this->assertTrue($resolution->hasWinner()); $this->assertEquals("Murphy", $resolution->getContestant()->getName()); $this->assertEquals(10, $resolution->getTime()); }
/** * Resolves the current buzzer competition and returns the resolution. * As a side-effect, this will also disable the buzzer. * * @return \Depotwarehouse\Jeopardy\Buzzer\BuzzerResolution */ public function resolveBuzzes() { $resolution = $this->resolver->resolve(); $this->buzzerStatus->disable(); return $resolution; }