assertEquals(15, unformatShortFormatToSeconds('15')); } /** * Tests unformatShortFormatToSeconds() with characters. */ function testUnformatShortFormatToSeconds_conversion() { $this->assertEquals(15, unformatShortFormatToSeconds('15')); $this->assertEquals(12, unformatShortFormatToSeconds('12s')); $this->assertEquals(180, unformatShortFormatToSeconds('3m')); $this->assertEquals(7200, unformatShortFormatToSeconds('2h')); $this->assertEquals(86400, unformatShortFormatToSeconds('1d')); $this->assertEquals(135, unformatShortFormatToSeconds('2m15s')); $this->assertEquals(7215, unformatShortFormatToSeconds('2h15s')); $this->assertEquals(172815, unformatShortFormatToSeconds('2d15s')); $this->assertEquals(173700, unformatShortFormatToSeconds('2d15m')); } /** * Tests unformatShortFormatToSeconds() with invalid values. */ function testUnformatShortFormatToSeconds_invalidNumber() { $this->assertEquals('abc', unformatShortFormatToSeconds('abc')); $this->assertEquals('', unformatShortFormatToSeconds('')); } }