/** * @inheritdoc */ public function beforeSave($insert) { if (parent::beforeSave($insert)) { $this->dt = TimeHelper::now(); $this->extension = strtolower($this->extension); return true; } return false; }
public function testToSeconds() { $this->assertNull(TimeHelper::toSeconds(null)); $this->assertNull(TimeHelper::toSeconds('dsasd')); $this->assertEquals(0, TimeHelper::toSeconds('00:00:00.000')); $this->assertEquals(2, TimeHelper::toSeconds('00:00:01.800')); $this->assertEquals(1, TimeHelper::toSeconds('00:00:01.12')); $this->assertEquals(422, TimeHelper::toSeconds('00:07:02')); $this->assertEquals(422, TimeHelper::toSeconds('00:07:02.360')); $this->assertEquals(423, TimeHelper::toSeconds('00:07:02.800')); $this->assertEquals(8593, TimeHelper::toSeconds('02:23:13.400')); }