slovocast/app/tests/Domain/Entity/EpisodeTest.php

33 lines
1.0 KiB
PHP
Raw Permalink Normal View History

<?php
namespace Slovocast\Tests\Domain\Entity;
use Slovocast\Domain\Entity\Episode;
use Slovocast\Tests\TestCase;
class EpisodeTest extends TestCase
{
public function testDurationParsing(): void
{
$oneHourThirtyMinutes = 5400;
$fortyNineMinutesEightSeconds = 2948;
$fourMinutesTwentySeconds = 260;
$sixMinutesNineSeconds = 369;
$twentyThreeHoursFortyThreeMinutesTwelveSeconds = 85392;
$r = Episode::parseDurationFromLength($oneHourThirtyMinutes);
$this->assertEquals("01:30:00", $r);
$r = Episode::parseDurationFromLength($fortyNineMinutesEightSeconds);
$this->assertEquals("49:08", $r);
$r = Episode::parseDurationFromLength($fourMinutesTwentySeconds);
$this->assertEquals("04:20", $r); // nice!
$r = Episode::parseDurationFromLength($sixMinutesNineSeconds);
$this->assertEquals("06:09", $r); // nice!
$r = Episode::parseDurationFromLength($twentyThreeHoursFortyThreeMinutesTwelveSeconds);
$this->assertEquals("23:43:12", $r);
}
}