2024-11-15 02:40:28 +00:00
|
|
|
<?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);
|
|
|
|
|
2024-11-15 02:44:49 +00:00
|
|
|
$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);
|
|
|
|
}
|
2024-11-15 02:40:28 +00:00
|
|
|
}
|