RU
apps/winzik / tests / PhoneUpdateMomentTest.php · commit 6576d6f
<?phpnamespace Tests;/** When the phone app may restart for its update (AutoUpdate::$goodMoment): never in the middle of a song. */final class PhoneUpdateMomentTest extends PlayerTestCase{    public function testTheUpdateWaitsForAPauseOrTheStartOfASongWithTheScreenOff(): void    {        $this->startPlayer();        $this->wz->player->stop();        self::assertTrue($this->wz->goodMomentToUpdate(true), 'nothing plays: at once');        $this->wz->playIndex(0);        $this->game->run(5);        self::assertSame('playing', $this->wz->player->state);        self::assertTrue($this->wz->goodMomentToUpdate(false), 'a song starts, the screen off: Android reopens the app by itself');        self::assertFalse($this->wz->goodMomentToUpdate(true), 'the screen on: the music would stop until a tap');        $this->wz->player->seek(5.0);        self::assertFalse($this->wz->goodMomentToUpdate(false), 'never in the middle of a song');        $this->wz->player->pause();        self::assertTrue($this->wz->goodMomentToUpdate(true), 'paused: at once');    }}