function testDurationSetterAndGetter() { $i = new Naf_Media_Info(); $i->setDuration(10); // set number of seconds $this->assertEqual(10, $i->getDuration()); $this->assertEqual('00:00:10.0', $i->getDurationString()); $hours = 1; $minutes = 9; $seconds = 9.1; $time = sprintf("%02d:%02d:%04.1f", $hours, $minutes, $seconds); $i->setDuration($time); // set duration string $this->assertEqual($hours * 3600 + $minutes * 60 + $seconds, $i->getDuration()); $this->assertEqual($time, $i->getDurationString()); // check for exception throw on illegal tiem string try { $i->setDuration('illegal'); $this->fail("Naf_Media_Exception should be raised"); } catch (Naf_Media_Exception $e) { } }